diff options
| author | 2021-05-29 21:12:52 -0400 | |
|---|---|---|
| committer | 2021-07-22 21:51:36 -0400 | |
| commit | 7df0815117c6bdc70775d78b4625f44835ede54a (patch) | |
| tree | a7e65a8b2452937ed0717b9d9fc23ea6e1034931 /src/shader_recompiler/backend/glsl | |
| parent | glsl: Fix GetAttribute return values (diff) | |
| download | yuzu-7df0815117c6bdc70775d78b4625f44835ede54a.tar.gz yuzu-7df0815117c6bdc70775d78b4625f44835ede54a.tar.xz yuzu-7df0815117c6bdc70775d78b4625f44835ede54a.zip | |
glsl: Implement more instructions used by SMO
Diffstat (limited to 'src/shader_recompiler/backend/glsl')
5 files changed, 16 insertions, 10 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp index c20747819..4bb20b8fa 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp | |||
| @@ -148,6 +148,10 @@ void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr, | |||
| 148 | throw NotImplementedException("Get Position for stage {}", ctx.stage); | 148 | throw NotImplementedException("Get Position for stage {}", ctx.stage); |
| 149 | } | 149 | } |
| 150 | break; | 150 | break; |
| 151 | case IR::Attribute::PointSpriteS: | ||
| 152 | case IR::Attribute::PointSpriteT: | ||
| 153 | ctx.AddF32("{}=gl_PointCoord.{};", inst, swizzle); | ||
| 154 | break; | ||
| 151 | case IR::Attribute::InstanceId: | 155 | case IR::Attribute::InstanceId: |
| 152 | ctx.AddF32("{}=intBitsToFloat(gl_InstanceID);", inst); | 156 | ctx.AddF32("{}=intBitsToFloat(gl_InstanceID);", inst); |
| 153 | break; | 157 | break; |
| @@ -174,7 +178,7 @@ void EmitSetAttribute(EmitContext& ctx, IR::Attribute attr, std::string_view val | |||
| 174 | } | 178 | } |
| 175 | switch (attr) { | 179 | switch (attr) { |
| 176 | case IR::Attribute::PointSize: | 180 | case IR::Attribute::PointSize: |
| 177 | ctx.Add("gl_Pointsize={};", value); | 181 | ctx.Add("gl_PointSize={};", value); |
| 178 | break; | 182 | break; |
| 179 | case IR::Attribute::PositionX: | 183 | case IR::Attribute::PositionX: |
| 180 | case IR::Attribute::PositionY: | 184 | case IR::Attribute::PositionY: |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp index 2ecfc2993..85d07b4de 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp | |||
| @@ -16,7 +16,7 @@ void EmitConvertS16F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::I | |||
| 16 | 16 | ||
| 17 | void EmitConvertS16F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 17 | void EmitConvertS16F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 18 | [[maybe_unused]] std::string_view value) { | 18 | [[maybe_unused]] std::string_view value) { |
| 19 | throw NotImplementedException("GLSL Instruction"); | 19 | ctx.AddS32("{}=int(float({}))&0xffff;", inst, value); |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | void EmitConvertS16F64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 22 | void EmitConvertS16F64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp index d1f7c5d91..e63e3f2bd 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp | |||
| @@ -376,7 +376,9 @@ void EmitImageQueryDimensions([[maybe_unused]] EmitContext& ctx, [[maybe_unused] | |||
| 376 | void EmitImageQueryLod([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 376 | void EmitImageQueryLod([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 377 | [[maybe_unused]] const IR::Value& index, | 377 | [[maybe_unused]] const IR::Value& index, |
| 378 | [[maybe_unused]] std::string_view coords) { | 378 | [[maybe_unused]] std::string_view coords) { |
| 379 | throw NotImplementedException("GLSL Instruction"); | 379 | const auto info{inst.Flags<IR::TextureInstInfo>()}; |
| 380 | const auto texture{Texture(ctx, info, index)}; | ||
| 381 | return ctx.AddF32x4("{}=vec4(textureQueryLod({},{}),0.0,0.0);", inst, texture, coords); | ||
| 380 | } | 382 | } |
| 381 | 383 | ||
| 382 | void EmitImageGradient([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 384 | void EmitImageGradient([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h index 07408d9e9..a1806b7f5 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h +++ b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h | |||
| @@ -86,10 +86,10 @@ void EmitSetZFlag(EmitContext& ctx); | |||
| 86 | void EmitSetSFlag(EmitContext& ctx); | 86 | void EmitSetSFlag(EmitContext& ctx); |
| 87 | void EmitSetCFlag(EmitContext& ctx); | 87 | void EmitSetCFlag(EmitContext& ctx); |
| 88 | void EmitSetOFlag(EmitContext& ctx); | 88 | void EmitSetOFlag(EmitContext& ctx); |
| 89 | void EmitWorkgroupId(EmitContext& ctx); | 89 | void EmitWorkgroupId(EmitContext& ctx, IR::Inst& inst); |
| 90 | void EmitLocalInvocationId(EmitContext& ctx, IR::Inst& inst); | 90 | void EmitLocalInvocationId(EmitContext& ctx, IR::Inst& inst); |
| 91 | void EmitInvocationId(EmitContext& ctx); | 91 | void EmitInvocationId(EmitContext& ctx, IR::Inst& inst); |
| 92 | void EmitSampleId(EmitContext& ctx); | 92 | void EmitSampleId(EmitContext& ctx, IR::Inst& inst); |
| 93 | void EmitIsHelperInvocation(EmitContext& ctx); | 93 | void EmitIsHelperInvocation(EmitContext& ctx); |
| 94 | void EmitYDirection(EmitContext& ctx, IR::Inst& inst); | 94 | void EmitYDirection(EmitContext& ctx, IR::Inst& inst); |
| 95 | void EmitLoadLocal(EmitContext& ctx, std::string_view word_offset); | 95 | void EmitLoadLocal(EmitContext& ctx, std::string_view word_offset); |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp index b8f95bd36..9af9ebeac 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp | |||
| @@ -203,15 +203,15 @@ void EmitSetOFlag(EmitContext& ctx) { | |||
| 203 | NotImplemented(); | 203 | NotImplemented(); |
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | void EmitWorkgroupId(EmitContext& ctx) { | 206 | void EmitWorkgroupId(EmitContext& ctx, IR::Inst& inst) { |
| 207 | NotImplemented(); | 207 | ctx.AddU32x3("{}=gl_WorkGroupID;", inst); |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | void EmitInvocationId(EmitContext& ctx) { | 210 | void EmitInvocationId(EmitContext& ctx, IR::Inst& inst) { |
| 211 | NotImplemented(); | 211 | NotImplemented(); |
| 212 | } | 212 | } |
| 213 | 213 | ||
| 214 | void EmitSampleId(EmitContext& ctx) { | 214 | void EmitSampleId(EmitContext& ctx, IR::Inst& inst) { |
| 215 | NotImplemented(); | 215 | NotImplemented(); |
| 216 | } | 216 | } |
| 217 | 217 | ||