summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
diff options
context:
space:
mode:
authorGravatar ameerj2021-06-14 11:32:28 -0400
committerGravatar ameerj2021-07-22 21:51:38 -0400
commitae4e452759573d145738688d9284077934e61ae4 (patch)
tree843caa97bc872322d3e80739492805062e6aee5e /src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
parentglsl: Add LoopSafety instructions (diff)
downloadyuzu-ae4e452759573d145738688d9284077934e61ae4.tar.gz
yuzu-ae4e452759573d145738688d9284077934e61ae4.tar.xz
yuzu-ae4e452759573d145738688d9284077934e61ae4.zip
glsl: Add Shader_GLSL logging
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_image.cpp')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_image.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
index c6b3df9c9..447eb8e0a 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
@@ -96,7 +96,7 @@ std::string GetOffsetVec(EmitContext& ctx, const IR::Value& offset) {
96 } 96 }
97 const bool has_var_aoffi{ctx.profile.support_gl_variable_aoffi}; 97 const bool has_var_aoffi{ctx.profile.support_gl_variable_aoffi};
98 if (!has_var_aoffi) { 98 if (!has_var_aoffi) {
99 // LOG_WARNING("Device does not support variable texture offsets, STUBBING"); 99 LOG_WARNING(Shader_GLSL, "Device does not support variable texture offsets, STUBBING");
100 } 100 }
101 const auto offset_str{has_var_aoffi ? ctx.var_alloc.Consume(offset) : "0"}; 101 const auto offset_str{has_var_aoffi ? ctx.var_alloc.Consume(offset) : "0"};
102 switch (offset.Type()) { 102 switch (offset.Type()) {
@@ -116,7 +116,7 @@ std::string GetOffsetVec(EmitContext& ctx, const IR::Value& offset) {
116std::string PtpOffsets(const IR::Value& offset, const IR::Value& offset2) { 116std::string PtpOffsets(const IR::Value& offset, const IR::Value& offset2) {
117 const std::array values{offset.InstRecursive(), offset2.InstRecursive()}; 117 const std::array values{offset.InstRecursive(), offset2.InstRecursive()};
118 if (!values[0]->AreAllArgsImmediates() || !values[1]->AreAllArgsImmediates()) { 118 if (!values[0]->AreAllArgsImmediates() || !values[1]->AreAllArgsImmediates()) {
119 // LOG_WARNING("Not all arguments in PTP are immediate, STUBBING"); 119 LOG_WARNING(Shader_GLSL, "Not all arguments in PTP are immediate, STUBBING");
120 return "ivec2[](ivec2(0), ivec2(1), ivec2(2), ivec2(3))"; 120 return "ivec2[](ivec2(0), ivec2(1), ivec2(2), ivec2(3))";
121 } 121 }
122 const IR::Opcode opcode{values[0]->GetOpcode()}; 122 const IR::Opcode opcode{values[0]->GetOpcode()};
@@ -152,7 +152,7 @@ void EmitImageSampleImplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Valu
152 const auto sparse_inst{PrepareSparse(inst)}; 152 const auto sparse_inst{PrepareSparse(inst)};
153 const bool supports_sparse{ctx.profile.support_gl_sparse_textures}; 153 const bool supports_sparse{ctx.profile.support_gl_sparse_textures};
154 if (sparse_inst && !supports_sparse) { 154 if (sparse_inst && !supports_sparse) {
155 // LOG_WARNING(..., "Device does not support sparse texture queries. STUBBING"); 155 LOG_WARNING(Shader_GLSL, "Device does not support sparse texture queries. STUBBING");
156 ctx.AddU1("{}=true;", *sparse_inst); 156 ctx.AddU1("{}=true;", *sparse_inst);
157 } 157 }
158 if (!sparse_inst || !supports_sparse) { 158 if (!sparse_inst || !supports_sparse) {
@@ -196,7 +196,7 @@ void EmitImageSampleExplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Valu
196 const auto sparse_inst{PrepareSparse(inst)}; 196 const auto sparse_inst{PrepareSparse(inst)};
197 const bool supports_sparse{ctx.profile.support_gl_sparse_textures}; 197 const bool supports_sparse{ctx.profile.support_gl_sparse_textures};
198 if (sparse_inst && !supports_sparse) { 198 if (sparse_inst && !supports_sparse) {
199 // LOG_WARNING(..., "Device does not support sparse texture queries. STUBBING"); 199 LOG_WARNING(Shader_GLSL, "Device does not support sparse texture queries. STUBBING");
200 ctx.AddU1("{}=true;", *sparse_inst); 200 ctx.AddU1("{}=true;", *sparse_inst);
201 } 201 }
202 if (!sparse_inst || !supports_sparse) { 202 if (!sparse_inst || !supports_sparse) {
@@ -239,9 +239,10 @@ void EmitImageSampleDrefImplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::
239 const bool use_grad{!ctx.profile.support_gl_texture_shadow_lod && 239 const bool use_grad{!ctx.profile.support_gl_texture_shadow_lod &&
240 ctx.stage != Stage::Fragment && needs_shadow_ext}; 240 ctx.stage != Stage::Fragment && needs_shadow_ext};
241 if (use_grad) { 241 if (use_grad) {
242 // LOG_WARNING(..., "Device lacks GL_EXT_texture_shadow_lod. Using textureGrad fallback"); 242 LOG_WARNING(Shader_GLSL,
243 "Device lacks GL_EXT_texture_shadow_lod. Using textureGrad fallback");
243 if (info.type == TextureType::ColorArrayCube) { 244 if (info.type == TextureType::ColorArrayCube) {
244 // LOG_WARNING(..., "textureGrad does not support ColorArrayCube. Stubbing"); 245 LOG_WARNING(Shader_GLSL, "textureGrad does not support ColorArrayCube. Stubbing");
245 ctx.AddF32("{}=0.0f;", inst); 246 ctx.AddF32("{}=0.0f;", inst);
246 return; 247 return;
247 } 248 }
@@ -291,9 +292,10 @@ void EmitImageSampleDrefExplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::
291 const bool use_grad{!ctx.profile.support_gl_texture_shadow_lod && needs_shadow_ext}; 292 const bool use_grad{!ctx.profile.support_gl_texture_shadow_lod && needs_shadow_ext};
292 const auto cast{needs_shadow_ext ? "vec4" : "vec3"}; 293 const auto cast{needs_shadow_ext ? "vec4" : "vec3"};
293 if (use_grad) { 294 if (use_grad) {
294 // LOG_WARNING(..., "Device lacks GL_EXT_texture_shadow_lod. Using textureGrad fallback"); 295 LOG_WARNING(Shader_GLSL,
296 "Device lacks GL_EXT_texture_shadow_lod. Using textureGrad fallback");
295 if (info.type == TextureType::ColorArrayCube) { 297 if (info.type == TextureType::ColorArrayCube) {
296 // LOG_WARNING(..., "textureGrad does not support ColorArrayCube. Stubbing"); 298 LOG_WARNING(Shader_GLSL, "textureGrad does not support ColorArrayCube. Stubbing");
297 ctx.AddF32("{}=0.0f;", inst); 299 ctx.AddF32("{}=0.0f;", inst);
298 return; 300 return;
299 } 301 }
@@ -329,7 +331,7 @@ void EmitImageGather(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
329 const auto sparse_inst{PrepareSparse(inst)}; 331 const auto sparse_inst{PrepareSparse(inst)};
330 const bool supports_sparse{ctx.profile.support_gl_sparse_textures}; 332 const bool supports_sparse{ctx.profile.support_gl_sparse_textures};
331 if (sparse_inst && !supports_sparse) { 333 if (sparse_inst && !supports_sparse) {
332 // LOG_WARNING(..., "Device does not support sparse texture queries. STUBBING"); 334 LOG_WARNING(Shader_GLSL, "Device does not support sparse texture queries. STUBBING");
333 ctx.AddU1("{}=true;", *sparse_inst); 335 ctx.AddU1("{}=true;", *sparse_inst);
334 } 336 }
335 if (!sparse_inst || !supports_sparse) { 337 if (!sparse_inst || !supports_sparse) {
@@ -376,7 +378,7 @@ void EmitImageGatherDref(EmitContext& ctx, IR::Inst& inst, const IR::Value& inde
376 const auto sparse_inst{PrepareSparse(inst)}; 378 const auto sparse_inst{PrepareSparse(inst)};
377 const bool supports_sparse{ctx.profile.support_gl_sparse_textures}; 379 const bool supports_sparse{ctx.profile.support_gl_sparse_textures};
378 if (sparse_inst && !supports_sparse) { 380 if (sparse_inst && !supports_sparse) {
379 // LOG_WARNING(..., "Device does not support sparse texture queries. STUBBING"); 381 LOG_WARNING(Shader_GLSL, "Device does not support sparse texture queries. STUBBING");
380 ctx.AddU1("{}=true;", *sparse_inst); 382 ctx.AddU1("{}=true;", *sparse_inst);
381 } 383 }
382 if (!sparse_inst || !supports_sparse) { 384 if (!sparse_inst || !supports_sparse) {
@@ -426,7 +428,7 @@ void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
426 const auto texel{ctx.var_alloc.Define(inst, GlslVarType::F32x4)}; 428 const auto texel{ctx.var_alloc.Define(inst, GlslVarType::F32x4)};
427 const bool supports_sparse{ctx.profile.support_gl_sparse_textures}; 429 const bool supports_sparse{ctx.profile.support_gl_sparse_textures};
428 if (sparse_inst && !supports_sparse) { 430 if (sparse_inst && !supports_sparse) {
429 // LOG_WARNING(..., "Device does not support sparse texture queries. STUBBING"); 431 LOG_WARNING(Shader_GLSL, "Device does not support sparse texture queries. STUBBING");
430 ctx.AddU1("{}=true;", *sparse_inst); 432 ctx.AddU1("{}=true;", *sparse_inst);
431 } 433 }
432 if (!sparse_inst || !supports_sparse) { 434 if (!sparse_inst || !supports_sparse) {