mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 21:32:50 +00:00
gl/vk: Fix ub256 and s32k vertex attributes; silence some unnecessary debug errors (#1757)
* gl/vk: Sample integer attribs with integer samplers * gl: silence useless DPRINTs where behaviour has already proven correct
This commit is contained in:
parent
c4102f3b18
commit
4260f68f85
@ -66,7 +66,20 @@ void GLVertexDecompilerThread::insertInputs(std::stringstream & OS, const std::v
|
|||||||
for (const ParamItem &PI : PT.items)
|
for (const ParamItem &PI : PT.items)
|
||||||
{
|
{
|
||||||
if (PI.name == std::get<1>(item))
|
if (PI.name == std::get<1>(item))
|
||||||
OS << "layout(location=" << location++ << ")" << " uniform samplerBuffer" << " " << PI.name << "_buffer;" << std::endl;
|
{
|
||||||
|
bool is_int = false;
|
||||||
|
for (auto &attrib : rsx_vertex_program.rsx_vertex_inputs)
|
||||||
|
{
|
||||||
|
if (attrib.location == std::get<0>(item))
|
||||||
|
{
|
||||||
|
if (attrib.int_type) is_int = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string samplerType = is_int ? "isamplerBuffer" : "samplerBuffer";
|
||||||
|
OS << "layout(location=" << location++ << ")" << " uniform " << samplerType << " " << PI.name << "_buffer;" << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -134,9 +147,13 @@ void add_input(std::stringstream & OS, const ParamItem &PI, const std::vector<rs
|
|||||||
if (real_input.location != PI.location)
|
if (real_input.location != PI.location)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
std::string vecType = " vec4 ";
|
||||||
|
if (real_input.int_type)
|
||||||
|
vecType = " ivec4 ";
|
||||||
|
|
||||||
if (!real_input.is_array)
|
if (!real_input.is_array)
|
||||||
{
|
{
|
||||||
OS << " vec4 " << PI.name << " = texelFetch(" << PI.name << "_buffer, 0);" << std::endl;
|
OS << vecType << PI.name << " = texelFetch(" << PI.name << "_buffer, 0);" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,15 +161,15 @@ void add_input(std::stringstream & OS, const ParamItem &PI, const std::vector<rs
|
|||||||
{
|
{
|
||||||
if (real_input.is_modulo)
|
if (real_input.is_modulo)
|
||||||
{
|
{
|
||||||
OS << " vec4 " << PI.name << "= texelFetch(" << PI.name << "_buffer, gl_VertexID %" << real_input.frequency << ");" << std::endl;
|
OS << vecType << PI.name << "= texelFetch(" << PI.name << "_buffer, gl_VertexID %" << real_input.frequency << ");" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OS << " vec4 " << PI.name << "= texelFetch(" << PI.name << "_buffer, gl_VertexID /" << real_input.frequency << ");" << std::endl;
|
OS << vecType << PI.name << "= texelFetch(" << PI.name << "_buffer, gl_VertexID /" << real_input.frequency << ");" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OS << " vec4 " << PI.name << "= texelFetch(" << PI.name << "_buffer, gl_VertexID);" << std::endl;
|
OS << vecType << PI.name << "= texelFetch(" << PI.name << "_buffer, gl_VertexID).rgba;" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,9 +109,6 @@ namespace gl
|
|||||||
{
|
{
|
||||||
if (w && h && mipmap && (tex.h != h || tex.w != w || tex.mipmap != mipmap))
|
if (w && h && mipmap && (tex.h != h || tex.w != w || tex.mipmap != mipmap))
|
||||||
{
|
{
|
||||||
LOG_ERROR(RSX, "Texture params are invalid for block starting 0x%X!", tex.data_addr);
|
|
||||||
LOG_ERROR(RSX, "Params passed w=%d, h=%d, mip=%d, found w=%d, h=%d, mip=%d", w, h, mipmap, tex.w, tex.h, tex.mipmap);
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,7 +237,6 @@ namespace gl
|
|||||||
|
|
||||||
if (region_overlaps(rtt_aligned_base, (rtt_aligned_base + rtt_block_sz), base, base+size))
|
if (region_overlaps(rtt_aligned_base, (rtt_aligned_base + rtt_block_sz), base, base+size))
|
||||||
{
|
{
|
||||||
LOG_NOTICE(RSX, "Dirty RTT FOUND addr=0x%X", base);
|
|
||||||
rtt.is_dirty = true;
|
rtt.is_dirty = true;
|
||||||
if (rtt.locked)
|
if (rtt.locked)
|
||||||
{
|
{
|
||||||
@ -322,8 +318,6 @@ namespace gl
|
|||||||
rtt.data_addr = base;
|
rtt.data_addr = base;
|
||||||
rtt.is_dirty = true;
|
rtt.is_dirty = true;
|
||||||
|
|
||||||
LOG_NOTICE(RSX, "New RTT created for block 0x%X + 0x%X", (u32)rtt.data_addr, rtt.block_sz);
|
|
||||||
|
|
||||||
lock_memory_region((u32)rtt.data_addr, rtt.block_sz);
|
lock_memory_region((u32)rtt.data_addr, rtt.block_sz);
|
||||||
rtt.locked = true;
|
rtt.locked = true;
|
||||||
|
|
||||||
@ -342,10 +336,8 @@ namespace gl
|
|||||||
|
|
||||||
if (region->locked && region->block_sz != size)
|
if (region->locked && region->block_sz != size)
|
||||||
{
|
{
|
||||||
LOG_NOTICE(RSX, "Unlocking RTT since size has changed!");
|
|
||||||
unlock_memory_region((u32)region->data_addr, region->block_sz);
|
unlock_memory_region((u32)region->data_addr, region->block_sz);
|
||||||
|
|
||||||
LOG_NOTICE(RSX, "Locking down RTT after size change!");
|
|
||||||
region->block_sz = size;
|
region->block_sz = size;
|
||||||
lock_memory_region((u32)region->data_addr, region->block_sz);
|
lock_memory_region((u32)region->data_addr, region->block_sz);
|
||||||
region->locked = true;
|
region->locked = true;
|
||||||
@ -517,7 +509,6 @@ namespace gl
|
|||||||
if (tex.protected_block_start <= address &&
|
if (tex.protected_block_start <= address &&
|
||||||
tex.protected_block_sz >(address - tex.protected_block_start))
|
tex.protected_block_sz >(address - tex.protected_block_start))
|
||||||
{
|
{
|
||||||
LOG_NOTICE(RSX, "Texture object is dirty! %d", tex.gl_id);
|
|
||||||
unlock_gl_object(tex);
|
unlock_gl_object(tex);
|
||||||
|
|
||||||
invalidate_rtts_in_range((u32)tex.data_addr, tex.block_sz);
|
invalidate_rtts_in_range((u32)tex.data_addr, tex.block_sz);
|
||||||
@ -541,7 +532,6 @@ namespace gl
|
|||||||
u32 offset = address - rtt_aligned_base;
|
u32 offset = address - rtt_aligned_base;
|
||||||
if (offset >= rtt_block_sz) continue;
|
if (offset >= rtt_block_sz) continue;
|
||||||
|
|
||||||
LOG_NOTICE(RSX, "Dirty non-texture RTT FOUND! addr=0x%X", rtt.data_addr);
|
|
||||||
rtt.is_dirty = true;
|
rtt.is_dirty = true;
|
||||||
|
|
||||||
unlock_memory_region(rtt_aligned_base, rtt_block_sz);
|
unlock_memory_region(rtt_aligned_base, rtt_block_sz);
|
||||||
|
@ -41,10 +41,10 @@ namespace vk
|
|||||||
* Set up buffer fetches to only work on 4-component access. This is hardware dependant so we use 4-component access to avoid branching based on IHV implementation
|
* Set up buffer fetches to only work on 4-component access. This is hardware dependant so we use 4-component access to avoid branching based on IHV implementation
|
||||||
* AMD GCN 1.0 for example does not support RGB32 formats for texel buffers
|
* AMD GCN 1.0 for example does not support RGB32 formats for texel buffers
|
||||||
*/
|
*/
|
||||||
const VkFormat vec1_types[] = { VK_FORMAT_R16_UNORM, VK_FORMAT_R32_SFLOAT, VK_FORMAT_R16_SFLOAT, VK_FORMAT_R8_UNORM, VK_FORMAT_R16_SINT, VK_FORMAT_R16_SFLOAT, VK_FORMAT_R8_UNORM };
|
const VkFormat vec1_types[] = { VK_FORMAT_R16_UNORM, VK_FORMAT_R32_SFLOAT, VK_FORMAT_R16_SFLOAT, VK_FORMAT_R8_UNORM, VK_FORMAT_R16_SINT, VK_FORMAT_R16_SFLOAT, VK_FORMAT_R8_UINT };
|
||||||
const VkFormat vec2_types[] = { VK_FORMAT_R16G16_UNORM, VK_FORMAT_R32G32_SFLOAT, VK_FORMAT_R16G16_SFLOAT, VK_FORMAT_R8G8_UNORM, VK_FORMAT_R16G16_SINT, VK_FORMAT_R16G16_SFLOAT, VK_FORMAT_R8G8_UNORM };
|
const VkFormat vec2_types[] = { VK_FORMAT_R16G16_UNORM, VK_FORMAT_R32G32_SFLOAT, VK_FORMAT_R16G16_SFLOAT, VK_FORMAT_R8G8_UNORM, VK_FORMAT_R16G16_SINT, VK_FORMAT_R16G16_SFLOAT, VK_FORMAT_R8G8_UINT };
|
||||||
const VkFormat vec3_types[] = { VK_FORMAT_R16G16B16A16_UNORM, VK_FORMAT_R32G32B32A32_SFLOAT, VK_FORMAT_R16G16B16A16_SFLOAT, VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_R16G16B16A16_SINT, VK_FORMAT_R16G16B16A16_SFLOAT, VK_FORMAT_R8G8B8A8_UNORM }; //VEC3 COMPONENTS NOT SUPPORTED!
|
const VkFormat vec3_types[] = { VK_FORMAT_R16G16B16A16_UNORM, VK_FORMAT_R32G32B32A32_SFLOAT, VK_FORMAT_R16G16B16A16_SFLOAT, VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_R16G16B16A16_SINT, VK_FORMAT_R16G16B16A16_SFLOAT, VK_FORMAT_R8G8B8A8_UINT }; //VEC3 COMPONENTS NOT SUPPORTED!
|
||||||
const VkFormat vec4_types[] = { VK_FORMAT_R16G16B16A16_UNORM, VK_FORMAT_R32G32B32A32_SFLOAT, VK_FORMAT_R16G16B16A16_SFLOAT, VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_R16G16B16A16_SINT, VK_FORMAT_R16G16B16A16_SFLOAT, VK_FORMAT_R8G8B8A8_UNORM };
|
const VkFormat vec4_types[] = { VK_FORMAT_R16G16B16A16_UNORM, VK_FORMAT_R32G32B32A32_SFLOAT, VK_FORMAT_R16G16B16A16_SFLOAT, VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_R16G16B16A16_SINT, VK_FORMAT_R16G16B16A16_SFLOAT, VK_FORMAT_R8G8B8A8_UINT };
|
||||||
|
|
||||||
const VkFormat* vec_selectors[] = { 0, vec1_types, vec2_types, vec3_types, vec4_types };
|
const VkFormat* vec_selectors[] = { 0, vec1_types, vec2_types, vec3_types, vec4_types };
|
||||||
|
|
||||||
|
@ -82,8 +82,19 @@ void VKVertexDecompilerThread::insertInputs(std::stringstream & OS, const std::v
|
|||||||
in.type = vk::glsl::input_type_texel_buffer;
|
in.type = vk::glsl::input_type_texel_buffer;
|
||||||
|
|
||||||
this->inputs.push_back(in);
|
this->inputs.push_back(in);
|
||||||
|
|
||||||
|
bool is_int = false;
|
||||||
|
for (auto &attrib : rsx_vertex_program.rsx_vertex_inputs)
|
||||||
|
{
|
||||||
|
if (attrib.location == std::get<0>(item))
|
||||||
|
{
|
||||||
|
if (attrib.int_type) is_int = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
OS << "layout(set = 0, binding=" << 3 + location++ << ")" << " uniform samplerBuffer" << " " << PI.name << "_buffer;" << std::endl;
|
std::string samplerType = is_int ? "isamplerBuffer" : "samplerBuffer";
|
||||||
|
OS << "layout(set = 0, binding=" << 3 + location++ << ")" << " uniform " << samplerType << " " << PI.name << "_buffer;" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,9 +182,13 @@ namespace vk
|
|||||||
if (real_input.location != PI.location)
|
if (real_input.location != PI.location)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
std::string vecType = " vec4 ";
|
||||||
|
if (real_input.int_type)
|
||||||
|
vecType = " ivec4 ";
|
||||||
|
|
||||||
if (!real_input.is_array)
|
if (!real_input.is_array)
|
||||||
{
|
{
|
||||||
OS << " vec4 " << PI.name << " = texelFetch(" << PI.name << "_buffer, 0);" << std::endl;
|
OS << vecType << PI.name << " = texelFetch(" << PI.name << "_buffer, 0);" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,15 +196,15 @@ namespace vk
|
|||||||
{
|
{
|
||||||
if (real_input.is_modulo)
|
if (real_input.is_modulo)
|
||||||
{
|
{
|
||||||
OS << " vec4 " << PI.name << "= texelFetch(" << PI.name << "_buffer, gl_VertexIndex %" << real_input.frequency << ");" << std::endl;
|
OS << vecType << PI.name << "= texelFetch(" << PI.name << "_buffer, gl_VertexIndex %" << real_input.frequency << ");" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OS << " vec4 " << PI.name << "= texelFetch(" << PI.name << "_buffer, gl_VertexIndex /" << real_input.frequency << ");" << std::endl;
|
OS << vecType << PI.name << "= texelFetch(" << PI.name << "_buffer, gl_VertexIndex /" << real_input.frequency << ");" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OS << " vec4 " << PI.name << "= texelFetch(" << PI.name << "_buffer, gl_VertexIndex).rgba;" << std::endl;
|
OS << vecType << PI.name << "= texelFetch(" << PI.name << "_buffer, gl_VertexIndex).rgba;" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user