summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/ir_opt/texture_pass.cpp
diff options
context:
space:
mode:
authorGravatar ameerj2021-06-15 17:23:57 -0400
committerGravatar ameerj2021-07-22 21:51:38 -0400
commitd36f667bc0adaa9f50d53efb4c908aadc38921a6 (patch)
tree13a6a6106ca576214db66d50a618b404cc5c7cac /src/shader_recompiler/ir_opt/texture_pass.cpp
parentglsl: Move gl_Position/generic attribute initialization to EmitProlgue (diff)
downloadyuzu-d36f667bc0adaa9f50d53efb4c908aadc38921a6.tar.gz
yuzu-d36f667bc0adaa9f50d53efb4c908aadc38921a6.tar.xz
yuzu-d36f667bc0adaa9f50d53efb4c908aadc38921a6.zip
glsl: Address rest of feedback
Diffstat (limited to 'src/shader_recompiler/ir_opt/texture_pass.cpp')
-rw-r--r--src/shader_recompiler/ir_opt/texture_pass.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/shader_recompiler/ir_opt/texture_pass.cpp b/src/shader_recompiler/ir_opt/texture_pass.cpp
index e9098239d..737f186ab 100644
--- a/src/shader_recompiler/ir_opt/texture_pass.cpp
+++ b/src/shader_recompiler/ir_opt/texture_pass.cpp
@@ -312,11 +312,14 @@ public:
312 } 312 }
313 313
314 u32 Add(const ImageBufferDescriptor& desc) { 314 u32 Add(const ImageBufferDescriptor& desc) {
315 return Add(image_buffer_descriptors, desc, [&desc](const auto& existing) { 315 const u32 index{Add(image_buffer_descriptors, desc, [&desc](const auto& existing) {
316 return desc.format == existing.format && desc.cbuf_index == existing.cbuf_index && 316 return desc.format == existing.format && desc.cbuf_index == existing.cbuf_index &&
317 desc.cbuf_offset == existing.cbuf_offset && desc.count == existing.count && 317 desc.cbuf_offset == existing.cbuf_offset && desc.count == existing.count &&
318 desc.size_shift == existing.size_shift; 318 desc.size_shift == existing.size_shift;
319 }); 319 })};
320 image_buffer_descriptors[index].is_written |= desc.is_written;
321 image_buffer_descriptors[index].is_read |= desc.is_read;
322 return index;
320 } 323 }
321 324
322 u32 Add(const TextureDescriptor& desc) { 325 u32 Add(const TextureDescriptor& desc) {
@@ -339,6 +342,7 @@ public:
339 desc.size_shift == existing.size_shift; 342 desc.size_shift == existing.size_shift;
340 })}; 343 })};
341 image_descriptors[index].is_written |= desc.is_written; 344 image_descriptors[index].is_written |= desc.is_written;
345 image_descriptors[index].is_read |= desc.is_read;
342 return index; 346 return index;
343 } 347 }
344 348
@@ -430,10 +434,12 @@ void TexturePass(Environment& env, IR::Program& program) {
430 throw NotImplementedException("Unexpected separate sampler"); 434 throw NotImplementedException("Unexpected separate sampler");
431 } 435 }
432 const bool is_written{inst->GetOpcode() != IR::Opcode::ImageRead}; 436 const bool is_written{inst->GetOpcode() != IR::Opcode::ImageRead};
437 const bool is_read{inst->GetOpcode() == IR::Opcode::ImageRead};
433 if (flags.type == TextureType::Buffer) { 438 if (flags.type == TextureType::Buffer) {
434 index = descriptors.Add(ImageBufferDescriptor{ 439 index = descriptors.Add(ImageBufferDescriptor{
435 .format = flags.image_format, 440 .format = flags.image_format,
436 .is_written = is_written, 441 .is_written = is_written,
442 .is_read = is_read,
437 .cbuf_index = cbuf.index, 443 .cbuf_index = cbuf.index,
438 .cbuf_offset = cbuf.offset, 444 .cbuf_offset = cbuf.offset,
439 .count = cbuf.count, 445 .count = cbuf.count,
@@ -444,6 +450,7 @@ void TexturePass(Environment& env, IR::Program& program) {
444 .type = flags.type, 450 .type = flags.type,
445 .format = flags.image_format, 451 .format = flags.image_format,
446 .is_written = is_written, 452 .is_written = is_written,
453 .is_read = is_read,
447 .cbuf_index = cbuf.index, 454 .cbuf_index = cbuf.index,
448 .cbuf_offset = cbuf.offset, 455 .cbuf_offset = cbuf.offset,
449 .count = cbuf.count, 456 .count = cbuf.count,