rsx: Code cleanup. Fixes several dozen warnings

- Wrap unused parameters as comments to prevent C1400
- Fix sized variable conversions with explicit casts
This commit is contained in:
kd-11 2017-06-18 17:53:02 +03:00
parent 11317acdbe
commit b2e906f4cc
32 changed files with 121 additions and 99 deletions

View file

@ -364,7 +364,7 @@ void write_vertex_array_data_to_buffer(gsl::span<gsl::byte> raw_dst_span, gsl::s
//Sometimes, we get a vertex attribute to be repeated. Just copy the supplied vertices only
//TODO: Stop these requests from getting here in the first place!
//TODO: Check if it is possible to have a repeating array with more than one attribute instance
const u32 real_count = src_ptr.size_bytes() / attribute_src_stride;
const u32 real_count = (u32)src_ptr.size_bytes() / attribute_src_stride;
if (real_count == 1) attribute_src_stride = 0; //Always fetch src[0]
//TODO: Determine favourable vertex threshold where vector setup costs become negligible

View file

@ -106,7 +106,7 @@ std::string compareFunctionImp(COMPARE f, const std::string &Op0, const std::str
}
}
void insert_d3d12_legacy_function(std::ostream& OS)
void insert_d3d12_legacy_function(std::ostream& OS, bool is_fragment_program)
{
OS << "float4 lit_legacy(float4 val)";
OS << "{\n";
@ -121,6 +121,9 @@ void insert_d3d12_legacy_function(std::ostream& OS)
OS << " return result;\n";
OS << "}\n\n";
if (!is_fragment_program)
return;
OS << "uint packSnorm2x16(float2 val)";
OS << "{\n";
OS << " uint high_bits = round(clamp(val.x, -1., 1.) * 32767.);\n";

View file

@ -6,4 +6,4 @@ std::string getFloatTypeNameImp(size_t elementCount);
std::string getFunctionImp(FUNCTION f);
std::string compareFunctionImp(COMPARE f, const std::string &Op0, const std::string &Op1);
void insert_d3d12_legacy_function(std::ostream&);
void insert_d3d12_legacy_function(std::ostream&, bool is_fragment_program);

View file

@ -196,12 +196,14 @@ namespace
case rsx::texture_dimension_extended::texture_dimension_3d:
case rsx::texture_dimension_extended::texture_dimension_cubemap: return " " + tex_name + " (" + sampler_name + ", " + coord_name + ".xyz) ";
}
fmt::throw_exception("Invalid texture dimension %d" HERE, (u32)prog.get_texture_dimension(index));
}
}
void D3D12FragmentDecompiler::insertMainStart(std::stringstream & OS)
{
insert_d3d12_legacy_function(OS);
insert_d3d12_legacy_function(OS, true);
const std::set<std::string> output_value =
{

View file

@ -119,6 +119,9 @@ void D3D12GSRender::load_program()
case D3D12_BLEND_INV_BLEND_FACTOR:
return D3D12_BLEND_ZERO;
}
LOG_ERROR(RSX, "No suitable conversion defined for blend factor 0x%X" HERE, (u32)in);
return in;
};
d3d_sfactor_rgb = flatten_d3d12_factor(d3d_sfactor_rgb);

View file

@ -170,7 +170,7 @@ namespace
void D3D12VertexProgramDecompiler::insertMainStart(std::stringstream & OS)
{
insert_d3d12_legacy_function(OS);
insert_d3d12_legacy_function(OS, false);
OS << "PixelInput main(uint vertex_id : SV_VertexID)" << std::endl;
OS << "{" << std::endl;
@ -203,11 +203,11 @@ void D3D12VertexProgramDecompiler::insertMainEnd(std::stringstream & OS)
{
OS << " PixelInput Out = (PixelInput)0;" << std::endl;
bool insert_front_diffuse = (rsx_vertex_program.output_mask & 1);
bool insert_front_specular = (rsx_vertex_program.output_mask & 2);
bool insert_front_diffuse = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_FRONTDIFFUSE) != 0;
bool insert_front_specular = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_FRONTSPECULAR) != 0;
bool insert_back_diffuse = (rsx_vertex_program.output_mask & 4);
bool insert_back_specular = (rsx_vertex_program.output_mask & 8);
bool insert_back_diffuse = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_BACKDIFFUSE) != 0;
bool insert_back_specular = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_BACKSPECULAR) != 0;
// Declare inside main function
for (auto &i : reg_table)

View file

@ -105,7 +105,7 @@ std::string compareFunctionImpl(COMPARE f, const std::string &Op0, const std::st
fmt::throw_exception("Unknown compare function" HERE);
}
void insert_glsl_legacy_function(std::ostream& OS)
void insert_glsl_legacy_function(std::ostream& OS, gl::glsl::program_domain domain)
{
OS << "vec4 lit_legacy(vec4 val)";
OS << "{\n";
@ -120,6 +120,9 @@ void insert_glsl_legacy_function(std::ostream& OS)
OS << " return result;\n";
OS << "}\n\n";
if (domain != gl::glsl::program_domain::glsl_fragment_program)
return;
//NOTE: We lose precision if we just store depth value into 8-bit textures i.e (depth, 0, 0)
//NOTE2: After testing with GOW, the w component is either the original depth or wraps around to the x component
//Since component.r == depth_value with some precision loss, just use the precise depth value for now (further testing needed)

View file

@ -1,9 +1,10 @@
#pragma once
#include "../Common/ShaderParam.h"
#include "GLHelpers.h"
#include <ostream>
std::string getFloatTypeNameImpl(size_t elementCount);
std::string getFunctionImpl(FUNCTION f);
std::string compareFunctionImpl(COMPARE f, const std::string &Op0, const std::string &Op1);
void insert_glsl_legacy_function(std::ostream& OS);
void insert_glsl_legacy_function(std::ostream& OS, gl::glsl::program_domain domain);

View file

@ -214,12 +214,14 @@ namespace
case rsx::texture_dimension_extended::texture_dimension_3d:
case rsx::texture_dimension_extended::texture_dimension_cubemap: return "texture(" + tex_name + ", (" + coord_name + ".xyz * " + tex_name + "_coord_scale))";
}
fmt::throw_exception("Invalid texture dimension %d" HERE, (u32)prog.get_texture_dimension(index));
}
}
void GLFragmentDecompilerThread::insertMainStart(std::stringstream & OS)
{
insert_glsl_legacy_function(OS);
insert_glsl_legacy_function(OS, gl::glsl::glsl_fragment_program);
const std::set<std::string> output_values =
{

View file

@ -774,7 +774,7 @@ bool GLGSRender::load_program()
u32 vertex_constants_offset;
u32 fragment_constants_offset;
const u32 fragment_constants_size = m_prog_buffer.get_fragment_constants_buffer_size(fragment_program);
const u32 fragment_constants_size = (const u32)m_prog_buffer.get_fragment_constants_buffer_size(fragment_program);
const u32 fragment_buffer_size = fragment_constants_size + (17 * 4 * sizeof(float));
if (manually_flush_ring_buffers)

View file

@ -52,10 +52,10 @@ private:
std::unique_ptr<gl::ring_buffer> m_index_ring_buffer;
u32 m_draw_calls = 0;
u32 m_begin_time = 0;
u32 m_draw_time = 0;
u32 m_vertex_upload_time = 0;
u32 m_textures_upload_time = 0;
s64 m_begin_time = 0;
s64 m_draw_time = 0;
s64 m_vertex_upload_time = 0;
s64 m_textures_upload_time = 0;
//Compare to see if transform matrix have changed
size_t m_transform_buffer_hash = 0;

View file

@ -783,8 +783,8 @@ namespace gl
{
protected:
GLsizeiptr m_data_loc = 0;
GLsizeiptr m_limit = 0;
u32 m_data_loc = 0;
u32 m_limit = 0;
void *m_memory_mapping = nullptr;
fence m_fence;
@ -807,7 +807,7 @@ namespace gl
verify(HERE), m_memory_mapping != nullptr;
m_data_loc = 0;
m_limit = size;
m_limit = ::narrow<u32>(size);
}
void create(target target_, GLsizeiptr size, const void* data_ = nullptr)
@ -818,7 +818,7 @@ namespace gl
virtual std::pair<void*, u32> alloc_from_heap(u32 alloc_size, u16 alignment)
{
u32 offset = (u32)m_data_loc;
u32 offset = m_data_loc;
if (m_data_loc) offset = align(offset, alignment);
if ((offset + alloc_size) > m_limit)
@ -854,7 +854,7 @@ namespace gl
m_id = 0;
}
virtual void reserve_storage_on_heap(u32 alloc_size) {}
virtual void reserve_storage_on_heap(u32 /*alloc_size*/) {}
virtual void unmap() {}
@ -873,8 +873,8 @@ namespace gl
class legacy_ring_buffer : public ring_buffer
{
u64 m_mapped_bytes = 0;
u64 m_mapping_offset = 0;
u32 m_mapped_bytes = 0;
u32 m_mapping_offset = 0;
public:
@ -888,7 +888,7 @@ namespace gl
m_memory_mapping = nullptr;
m_data_loc = 0;
m_limit = size;
m_limit = ::narrow<u32>(size);
}
void create(target target_, GLsizeiptr size, const void* data_ = nullptr)
@ -1990,6 +1990,12 @@ namespace gl
namespace glsl
{
enum program_domain
{
glsl_vertex_program = 0,
glsl_fragment_program = 1
};
class compilation_exception : public exception
{
public:

View file

@ -11,21 +11,21 @@ struct GLTraits
using pipeline_properties = void*;
static
void recompile_fragment_program(const RSXFragmentProgram &RSXFP, fragment_program_type& fragmentProgramData, size_t ID)
void recompile_fragment_program(const RSXFragmentProgram &RSXFP, fragment_program_type& fragmentProgramData, size_t /*ID*/)
{
fragmentProgramData.Decompile(RSXFP);
fragmentProgramData.Compile();
}
static
void recompile_vertex_program(const RSXVertexProgram &RSXVP, vertex_program_type& vertexProgramData, size_t ID)
void recompile_vertex_program(const RSXVertexProgram &RSXVP, vertex_program_type& vertexProgramData, size_t /*ID*/)
{
vertexProgramData.Decompile(RSXVP);
vertexProgramData.Compile();
}
static
pipeline_storage_type build_pipeline(const vertex_program_type &vertexProgramData, const fragment_program_type &fragmentProgramData, const pipeline_properties &pipelineProperties)
pipeline_storage_type build_pipeline(const vertex_program_type &vertexProgramData, const fragment_program_type &fragmentProgramData, const pipeline_properties&)
{
pipeline_storage_type result;
__glcheck result.create()

View file

@ -160,7 +160,7 @@ struct gl_render_target_traits
static
std::unique_ptr<gl::render_target> create_new_surface(
u32 address,
u32 /*address*/,
rsx::surface_color_format surface_color_format,
size_t width,
size_t height
@ -172,7 +172,7 @@ struct gl_render_target_traits
auto internal_fmt = rsx::internals::sized_internal_format(surface_color_format);
result->recreate(gl::texture::target::texture2D);
result->set_native_pitch(width * format.channel_count * format.channel_size);
result->set_native_pitch((u16)width * format.channel_count * format.channel_size);
result->set_compatible_format(internal_fmt);
__glcheck result->config()
@ -192,7 +192,7 @@ struct gl_render_target_traits
static
std::unique_ptr<gl::render_target> create_new_surface(
u32 address,
u32 /*address*/,
rsx::surface_depth_format surface_depth_format,
size_t width,
size_t height
@ -228,21 +228,21 @@ struct gl_render_target_traits
static void prepare_rtt_for_drawing(void *, gl::render_target*) {}
static void prepare_rtt_for_sampling(void *, gl::render_target*) {}
static void prepare_ds_for_drawing(void *, gl::render_target *ds) {}
static void prepare_ds_for_drawing(void *, gl::render_target*) {}
static void prepare_ds_for_sampling(void *, gl::render_target*) {}
static void invalidate_rtt_surface_contents(void *, gl::render_target *ds) {}
static void invalidate_rtt_surface_contents(void *, gl::render_target*) {}
static void invalidate_depth_surface_contents(void *, gl::render_target *ds) { ds->set_cleared(false); }
static
bool rtt_has_format_width_height(const std::unique_ptr<gl::render_target> &rtt, rsx::surface_color_format surface_color_format, size_t width, size_t height)
bool rtt_has_format_width_height(const std::unique_ptr<gl::render_target> &rtt, rsx::surface_color_format, size_t width, size_t height)
{
// TODO: check format
return rtt->width() == width && rtt->height() == height;
}
static
bool ds_has_format_width_height(const std::unique_ptr<gl::render_target> &rtt, rsx::surface_depth_format surface_depth_stencil_format, size_t width, size_t height)
bool ds_has_format_width_height(const std::unique_ptr<gl::render_target> &rtt, rsx::surface_depth_format, size_t width, size_t height)
{
// TODO: check format
return rtt->width() == width && rtt->height() == height;
@ -268,7 +268,7 @@ struct gl_render_target_traits
return result;
}
static std::vector<u8> issue_stencil_download_command(gl::render_target* depth_stencil_buffer, size_t width, size_t height)
static std::vector<u8> issue_stencil_download_command(gl::render_target*, size_t width, size_t height)
{
std::vector<u8> result(width * height * 4);
return result;
@ -357,7 +357,7 @@ private:
return false;
}
bool fits(gl::render_target *src, std::pair<u16, u16> &dims, u16 x_offset, u16 y_offset, u16 width, u16 height) const
bool fits(gl::render_target*, std::pair<u16, u16> &dims, u16 x_offset, u16 y_offset, u16 width, u16 height) const
{
if ((x_offset + width) > dims.first) return false;
if ((y_offset + height) > dims.second) return false;
@ -369,7 +369,6 @@ public:
surface_subresource get_surface_subresource_if_applicable(u32 texaddr, u16 requested_width, u16 requested_height, u16 requested_pitch, bool scale_to_fit =false, bool crop=false)
{
gl::render_target *surface = nullptr;
bool is_subslice = false;
u16 x_offset = 0;
u16 y_offset = 0;
@ -388,7 +387,7 @@ public:
if (scale_to_fit)
{
f32 pitch_scaling = (f32)requested_pitch / surface->get_native_pitch();
requested_width /= pitch_scaling;
requested_width = (u16)((f32)requested_width / pitch_scaling);
}
if (fits(surface, dims, x_offset, y_offset, requested_width, requested_height))
@ -428,7 +427,7 @@ public:
if (scale_to_fit)
{
f32 pitch_scaling = (f32)requested_pitch / surface->get_native_pitch();
requested_width /= pitch_scaling;
requested_width = (u16)((f32)requested_width / pitch_scaling);
}
if (fits(surface, dims, x_offset, y_offset, requested_width, requested_height))

View file

@ -91,7 +91,7 @@ namespace gl
GlyphManager glyph_source;
auto points = glyph_source.generate_point_map();
const u32 buffer_size = points.size() * sizeof(GlyphManager::glyph_point);
const size_t buffer_size = points.size() * sizeof(GlyphManager::glyph_point);
m_text_buffer.data(buffer_size, points.data());
m_offsets = glyph_source.get_glyph_offsets();
@ -184,7 +184,7 @@ namespace gl
m_vao.bind();
glMultiDrawArrays(GL_POINTS, offsets.data(), counts.data(), counts.size());
glMultiDrawArrays(GL_POINTS, (const GLint*)offsets.data(), (const GLsizei*)counts.data(), (GLsizei)counts.size());
glBindVertexArray(old_vao);
}

View file

@ -175,7 +175,7 @@ namespace gl
}
glSamplerParameteri(samplerHandle, GL_TEXTURE_MAG_FILTER, tex_mag_filter(tex.mag_filter()));
glSamplerParameteri(samplerHandle, GL_TEXTURE_MAX_ANISOTROPY_EXT, ::gl::max_aniso(tex.max_aniso()));
glSamplerParameterf(samplerHandle, GL_TEXTURE_MAX_ANISOTROPY_EXT, ::gl::max_aniso(tex.max_aniso()));
const u32 texture_format = tex.format() & ~(CELL_GCM_TEXTURE_UN | CELL_GCM_TEXTURE_LN);
if (texture_format == CELL_GCM_TEXTURE_DEPTH16 || texture_format == CELL_GCM_TEXTURE_DEPTH24_D8)

View file

@ -452,7 +452,7 @@ namespace gl
GLGSRender *m_renderer;
std::thread::id m_renderer_thread;
cached_texture_section *find_texture_from_dimensions(u64 texaddr, u32 w, u32 h)
cached_texture_section *find_texture_from_dimensions(u32 texaddr, u32 w, u32 h)
{
std::lock_guard<std::mutex> lock(m_section_mutex);
@ -701,7 +701,7 @@ namespace gl
*/
const f32 internal_scale = (f32)tex_pitch / native_pitch;
const u32 internal_width = tex_width * internal_scale;
const u32 internal_width = (const u32)(tex_width * internal_scale);
const surface_subresource rsc = m_rtts.get_surface_subresource_if_applicable(texaddr, internal_width, tex_height, tex_pitch, true);
if (rsc.surface)
@ -819,7 +819,7 @@ namespace gl
std::lock_guard<std::mutex> lock(m_section_mutex);
cached_texture_section &cached = create_texture(gl_texture.id(), texaddr, get_texture_size(tex), tex_width, tex_height);
cached_texture_section &cached = create_texture(gl_texture.id(), texaddr, (const u32)get_texture_size(tex), tex_width, tex_height);
cached.protect(utils::protection::ro);
cached.set_dirty(false);
@ -1047,8 +1047,8 @@ namespace gl
//Offset in x and y for src is 0 (it is already accounted for when getting pixels_src)
//Reproject final clip onto source...
const u16 src_w = clip_dimensions.width / scale_x;
const u16 src_h = clip_dimensions.height / scale_y;
const u16 src_w = (const u16)((f32)clip_dimensions.width / scale_x);
const u16 src_h = (const u16)((f32)clip_dimensions.height / scale_y);
areai src_area = { 0, 0, src_w, src_h };
areai dst_area = { 0, 0, dst.clip_width, dst.clip_height };
@ -1184,8 +1184,8 @@ namespace gl
{
f32 subres_scaling_x = (f32)src.pitch / src_subres.surface->get_native_pitch();
dst_area.x2 = (src_subres.w * scale_x * subres_scaling_x);
dst_area.y2 = (src_subres.h * scale_y);
dst_area.x2 = (int)(src_subres.w * scale_x * subres_scaling_x);
dst_area.y2 = (int)(src_subres.h * scale_y);
}
src_area.x2 = src_subres.w;
@ -1209,8 +1209,8 @@ namespace gl
if (dst.clip_x || dst.clip_y)
{
//Reproject clip offsets onto source
const u16 scaled_clip_offset_x = dst.clip_x / scale_x;
const u16 scaled_clip_offset_y = dst.clip_y / scale_y;
const u16 scaled_clip_offset_x = (const u16)((f32)dst.clip_x / scale_x);
const u16 scaled_clip_offset_y = (const u16)((f32)dst.clip_y / scale_y);
src_area.x1 += scaled_clip_offset_x;
src_area.x2 += scaled_clip_offset_x;

View file

@ -136,11 +136,11 @@ static const vertex_reg_info reg_table[] =
void GLVertexDecompilerThread::insertOutputs(std::stringstream & OS, const std::vector<ParamType> & outputs)
{
bool insert_front_diffuse = (rsx_vertex_program.output_mask & 1);
bool insert_back_diffuse = (rsx_vertex_program.output_mask & 4);
bool insert_front_diffuse = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_FRONTDIFFUSE) != 0;
bool insert_back_diffuse = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_BACKDIFFUSE) != 0;
bool insert_front_specular = (rsx_vertex_program.output_mask & 2);
bool insert_back_specular = (rsx_vertex_program.output_mask & 8);
bool insert_front_specular = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_FRONTSPECULAR) != 0;
bool insert_back_specular = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_BACKSPECULAR) != 0;
bool front_back_diffuse = (insert_back_diffuse && insert_front_diffuse);
bool front_back_specular = (insert_back_specular && insert_front_specular);
@ -196,6 +196,8 @@ namespace
return "vec4(" + value + ", " + value + ", 1., 1.)";
case 3:
return "vec4(" + value + ", " + value + ", " + value + ", 1.)";
default:
LOG_ERROR(RSX, "invalid vector size %d" HERE, vector_size);
case 1:
case 4:
//Expand not required
@ -254,7 +256,7 @@ namespace
void GLVertexDecompilerThread::insertMainStart(std::stringstream & OS)
{
insert_glsl_legacy_function(OS);
insert_glsl_legacy_function(OS, gl::glsl::glsl_vertex_program);
std::string parameters = "";
for (int i = 0; i < 16; ++i)
@ -341,11 +343,11 @@ void GLVertexDecompilerThread::insertMainEnd(std::stringstream & OS)
OS << std::endl << " vs_main(" << parameters << ");" << std::endl << std::endl;
bool insert_front_diffuse = (rsx_vertex_program.output_mask & 1);
bool insert_front_specular = (rsx_vertex_program.output_mask & 2);
bool insert_front_diffuse = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_FRONTDIFFUSE) != 0;
bool insert_front_specular = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_FRONTSPECULAR) != 0;
bool insert_back_diffuse = (rsx_vertex_program.output_mask & 4);
bool insert_back_specular = (rsx_vertex_program.output_mask & 8);
bool insert_back_diffuse = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_BACKDIFFUSE) != 0;
bool insert_back_specular = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_BACKSPECULAR) != 0;
bool front_back_diffuse = (insert_back_diffuse && insert_front_diffuse);
bool front_back_specular = (insert_back_specular && insert_front_specular);

View file

@ -31,7 +31,7 @@ protected:
const RSXVertexProgram &rsx_vertex_program;
public:
GLVertexDecompilerThread(const RSXVertexProgram &prog, std::string& shader, ParamArray& parr)
GLVertexDecompilerThread(const RSXVertexProgram &prog, std::string& shader, ParamArray&)
: VertexProgramDecompiler(prog)
, m_shader(shader)
, rsx_vertex_program(prog)

View file

@ -304,7 +304,7 @@ namespace rsx
u32 thread::get_push_buffer_index_count() const
{
return element_push_buffer.size();
return (u32)element_push_buffer.size();
}
void thread::end()
@ -822,13 +822,9 @@ namespace rsx
case rsx::vertex_base_type::s32k:
case rsx::vertex_base_type::ub256:
return true;
case rsx::vertex_base_type::f:
case rsx::vertex_base_type::cmp:
case rsx::vertex_base_type::sf:
case rsx::vertex_base_type::s1:
case rsx::vertex_base_type::ub:
return false;
}
return false;
}
}

View file

@ -197,10 +197,10 @@ namespace rsx
virtual void on_init_rsx() = 0;
virtual void on_init_thread() = 0;
virtual bool do_method(u32 cmd, u32 value) { return false; }
virtual bool do_method(u32 /*cmd*/, u32 /*value*/) { return false; }
virtual void flip(int buffer) = 0;
virtual u64 timestamp() const;
virtual bool on_access_violation(u32 address, bool is_writing) { return false; }
virtual bool on_access_violation(u32 /*address*/, bool /*is_writing*/) { return false; }
gsl::span<const gsl::byte> get_raw_index_array(const std::vector<std::pair<u32, u32> >& draw_indexed_clause) const;
gsl::span<const gsl::byte> get_raw_vertex_buffer(const rsx::data_array_format_info&, u32 base_offset, const std::vector<std::pair<u32, u32>>& vertex_ranges) const;
@ -291,7 +291,7 @@ namespace rsx
virtual std::pair<std::string, std::string> get_programs() const { return std::make_pair("", ""); };
virtual bool scaled_image_from_memory(blit_src_info& src_info, blit_dst_info& dst_info, bool interpolate){ return false; }
virtual bool scaled_image_from_memory(blit_src_info& /*src_info*/, blit_dst_info& /*dst_info*/, bool /*interpolate*/){ return false; }
public:
void reset();

View file

@ -104,7 +104,7 @@ namespace vk
fmt::throw_exception("Unknown compare function" HERE);
}
void insert_glsl_legacy_function(std::ostream& OS)
void insert_glsl_legacy_function(std::ostream& OS, glsl::program_domain domain)
{
OS << "vec4 lit_legacy(vec4 val)";
OS << "{\n";
@ -119,6 +119,9 @@ namespace vk
OS << " return result;\n";
OS << "}\n\n";
if (domain == glsl::program_domain::glsl_vertex_program)
return;
//NOTE: After testing with GOW, the w component is either the original depth or wraps around to the x component
//Since component.r == depth_value with some precision loss, just use the precise depth value for now (further testing needed)
OS << "vec4 decodeLinearDepth(float depth_value)\n";

View file

@ -13,7 +13,7 @@ namespace vk
std::string getFloatTypeNameImpl(size_t elementCount);
std::string getFunctionImpl(FUNCTION f);
std::string compareFunctionImpl(COMPARE f, const std::string &Op0, const std::string &Op1);
void insert_glsl_legacy_function(std::ostream& OS);
void insert_glsl_legacy_function(std::ostream& OS, glsl::program_domain domain);
const varying_register_t& get_varying_register(const std::string& name);
bool compile_glsl_to_spv(std::string& shader, glsl::program_domain domain, std::vector<u32> &spv);

View file

@ -229,12 +229,14 @@ namespace vk
case rsx::texture_dimension_extended::texture_dimension_3d:
case rsx::texture_dimension_extended::texture_dimension_cubemap: return "texture(" + tex_name + ", " + coord_name + ".xyz)";
}
fmt::throw_exception("Invalid texture dimension %d" HERE, (u32)prog.get_texture_dimension(index));
}
}
void VKFragmentDecompilerThread::insertMainStart(std::stringstream & OS)
{
vk::insert_glsl_legacy_function(OS);
vk::insert_glsl_legacy_function(OS, vk::glsl::program_domain::glsl_fragment_program);
const std::set<std::string> output_values =
{

View file

@ -926,7 +926,7 @@ void VKGSRender::end()
*m_device,
VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_REPEAT,
!!(rsx::method_registers.vertex_textures[i].format() & CELL_GCM_TEXTURE_UN),
0, 1.f, rsx::method_registers.vertex_textures[i].min_lod(), rsx::method_registers.vertex_textures[i].max_lod(),
0.f, 1.f, (f32)rsx::method_registers.vertex_textures[i].min_lod(), (f32)rsx::method_registers.vertex_textures[i].max_lod(),
VK_FILTER_NEAREST, VK_FILTER_NEAREST, VK_SAMPLER_MIPMAP_MODE_NEAREST, vk::get_border_color(rsx::method_registers.vertex_textures[i].border_color())
));
@ -1138,7 +1138,7 @@ void VKGSRender::clear_surface(u32 mask)
vkCmdBeginRenderPass(*m_current_command_buffer, &rp_begin, VK_SUBPASS_CONTENTS_INLINE);
vkCmdClearAttachments(*m_current_command_buffer, clear_descriptors.size(), clear_descriptors.data(), clear_regions.size(), clear_regions.data());
vkCmdClearAttachments(*m_current_command_buffer, (u32)clear_descriptors.size(), clear_descriptors.data(), (u32)clear_regions.size(), clear_regions.data());
vkCmdEndRenderPass(*m_current_command_buffer);
}

View file

@ -74,14 +74,14 @@ struct VKTraits
using pipeline_properties = vk::pipeline_props;
static
void recompile_fragment_program(const RSXFragmentProgram &RSXFP, fragment_program_type& fragmentProgramData, size_t ID)
void recompile_fragment_program(const RSXFragmentProgram &RSXFP, fragment_program_type& fragmentProgramData, size_t /*ID*/)
{
fragmentProgramData.Decompile(RSXFP);
fragmentProgramData.Compile();
}
static
void recompile_vertex_program(const RSXVertexProgram &RSXVP, vertex_program_type& vertexProgramData, size_t ID)
void recompile_vertex_program(const RSXVertexProgram &RSXVP, vertex_program_type& vertexProgramData, size_t /*ID*/)
{
vertexProgramData.Decompile(RSXVP);
vertexProgramData.Compile();

View file

@ -183,17 +183,17 @@ namespace rsx
return false;
}
static download_buffer_object issue_download_command(surface_type, surface_color_format color_format, size_t width, size_t, ...)
static download_buffer_object issue_download_command(surface_type, surface_color_format, size_t /*width*/, size_t /*height*/, ...)
{
return nullptr;
}
static download_buffer_object issue_depth_download_command(surface_type, surface_depth_format depth_format, size_t width, size_t height, ...)
static download_buffer_object issue_depth_download_command(surface_type, surface_depth_format, size_t /*width*/, size_t /*height*/, ...)
{
return nullptr;
}
static download_buffer_object issue_stencil_download_command(surface_type, surface_depth_format depth_format, size_t width, size_t height, ...)
static download_buffer_object issue_stencil_download_command(surface_type, surface_depth_format, size_t /*width*/, size_t /*height*/, ...)
{
return nullptr;
}

View file

@ -281,7 +281,7 @@ namespace vk
{
private:
std::vector<cached_texture_section> m_cache;
std::pair<u64, u64> texture_cache_range = std::make_pair(0xFFFFFFFF, 0);
std::pair<u32, u32> texture_cache_range = std::make_pair(0xFFFFFFFF, 0);
std::vector<std::unique_ptr<vk::image_view> > m_temporary_image_view;
std::vector<std::unique_ptr<vk::image>> m_dirty_textures;
@ -390,7 +390,7 @@ namespace vk
return { final_mapping[1], final_mapping[2], final_mapping[3], final_mapping[0] };
}
VkComponentMapping get_component_map(rsx::vertex_texture &tex, u32 gcm_format)
VkComponentMapping get_component_map(rsx::vertex_texture&, u32 gcm_format)
{
auto mapping = vk::get_component_mapping(gcm_format);
return { mapping[1], mapping[2], mapping[3], mapping[0] };

View file

@ -287,7 +287,7 @@ namespace
size_t data_size = rsx::get_vertex_type_size_on_host(vertex_register.type, vertex_register.attribute_size);
const VkFormat format = vk::get_suitable_vk_format(vertex_register.type, vertex_register.attribute_size);
u32 offset_in_attrib_buffer = 0;
size_t offset_in_attrib_buffer = 0;
if (vk::requires_component_expansion(vertex_register.type, vertex_register.attribute_size))
{
@ -316,7 +316,7 @@ namespace
void operator()(const rsx::empty_vertex_array& vbo)
{
u32 offset_in_attrib_buffer = m_attrib_ring_info.alloc<256>(32);
size_t offset_in_attrib_buffer = m_attrib_ring_info.alloc<256>(32);
void *dst = m_attrib_ring_info.map(offset_in_attrib_buffer, 32);
memset(dst, 0, 32);
m_attrib_ring_info.unmap();
@ -494,7 +494,7 @@ namespace
const VkFormat format =
vk::get_suitable_vk_format(vertex_info.type(), vertex_info.size());
u32 offset_in_attrib_buffer = m_attrib_ring_info.alloc<256>(data_size);
size_t offset_in_attrib_buffer = m_attrib_ring_info.alloc<256>(data_size);
u8* src = reinterpret_cast<u8*>(
rsx::method_registers.current_draw_clause.inline_vertex_array.data());
u8* dst =

View file

@ -173,11 +173,11 @@ static const vertex_reg_info reg_table[] =
void VKVertexDecompilerThread::insertOutputs(std::stringstream & OS, const std::vector<ParamType> & outputs)
{
bool insert_front_diffuse = (rsx_vertex_program.output_mask & 1);
bool insert_back_diffuse = (rsx_vertex_program.output_mask & 4);
bool insert_front_diffuse = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_FRONTDIFFUSE) != 0;
bool insert_back_diffuse = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_BACKDIFFUSE) != 0;
bool insert_front_specular = (rsx_vertex_program.output_mask & 2);
bool insert_back_specular = (rsx_vertex_program.output_mask & 8);
bool insert_front_specular = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_FRONTSPECULAR) != 0;
bool insert_back_specular = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_BACKSPECULAR) != 0;
for (auto &i : reg_table)
{
@ -241,7 +241,7 @@ namespace vk
void VKVertexDecompilerThread::insertMainStart(std::stringstream & OS)
{
vk::insert_glsl_legacy_function(OS);
vk::insert_glsl_legacy_function(OS, vk::glsl::program_domain::glsl_vertex_program);
std::string parameters = "";
for (int i = 0; i < 16; ++i)
@ -317,11 +317,11 @@ void VKVertexDecompilerThread::insertMainEnd(std::stringstream & OS)
OS << std::endl << " vs_main(" << parameters << ");" << std::endl << std::endl;
bool insert_front_diffuse = (rsx_vertex_program.output_mask & 1);
bool insert_front_specular = (rsx_vertex_program.output_mask & 2);
bool insert_front_diffuse = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_FRONTDIFFUSE) != 0;
bool insert_front_specular = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_FRONTSPECULAR) != 0;
bool insert_back_diffuse = (rsx_vertex_program.output_mask & 4);
bool insert_back_specular = (rsx_vertex_program.output_mask & 8);
bool insert_back_diffuse = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_BACKDIFFUSE) != 0;
bool insert_back_specular = (rsx_vertex_program.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_BACKSPECULAR) != 0;
for (auto &i : reg_table)
{

View file

@ -25,7 +25,7 @@ protected:
const RSXVertexProgram &rsx_vertex_program;
public:
VKVertexDecompilerThread(const RSXVertexProgram &prog, std::string& shader, ParamArray& parr, class VKVertexProgram &dst)
VKVertexDecompilerThread(const RSXVertexProgram &prog, std::string& shader, ParamArray&, class VKVertexProgram &dst)
: VertexProgramDecompiler(prog)
, m_shader(shader)
, rsx_vertex_program(prog)

View file

@ -609,8 +609,8 @@ namespace rsx
src_info.height = in_h;
src_info.pitch = in_pitch;
src_info.slice_h = slice_h;
src_info.offset_x = in_x;
src_info.offset_y = in_y;
src_info.offset_x = (u16)in_x;
src_info.offset_y = (u16)in_y;
src_info.pixels = pixels_src;
src_info.rsx_address = get_address(src_offset, src_dma);