yuzu-emu
/
yuzu
Archived
1
0
Fork 0

glsl: Implement more instructions used by SMO

This commit is contained in:
ameerj 2021-05-29 21:12:52 -04:00
parent 80eec85867
commit 7df0815117
5 changed files with 18 additions and 12 deletions

View File

@ -148,6 +148,10 @@ void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr,
throw NotImplementedException("Get Position for stage {}", ctx.stage); throw NotImplementedException("Get Position for stage {}", ctx.stage);
} }
break; break;
case IR::Attribute::PointSpriteS:
case IR::Attribute::PointSpriteT:
ctx.AddF32("{}=gl_PointCoord.{};", inst, swizzle);
break;
case IR::Attribute::InstanceId: case IR::Attribute::InstanceId:
ctx.AddF32("{}=intBitsToFloat(gl_InstanceID);", inst); ctx.AddF32("{}=intBitsToFloat(gl_InstanceID);", inst);
break; break;
@ -174,7 +178,7 @@ void EmitSetAttribute(EmitContext& ctx, IR::Attribute attr, std::string_view val
} }
switch (attr) { switch (attr) {
case IR::Attribute::PointSize: case IR::Attribute::PointSize:
ctx.Add("gl_Pointsize={};", value); ctx.Add("gl_PointSize={};", value);
break; break;
case IR::Attribute::PositionX: case IR::Attribute::PositionX:
case IR::Attribute::PositionY: case IR::Attribute::PositionY:

View File

@ -16,7 +16,7 @@ void EmitConvertS16F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::I
void EmitConvertS16F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, void EmitConvertS16F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) { [[maybe_unused]] std::string_view value) {
throw NotImplementedException("GLSL Instruction"); ctx.AddS32("{}=int(float({}))&0xffff;", inst, value);
} }
void EmitConvertS16F64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, void EmitConvertS16F64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,

View File

@ -376,7 +376,9 @@ void EmitImageQueryDimensions([[maybe_unused]] EmitContext& ctx, [[maybe_unused]
void EmitImageQueryLod([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, void EmitImageQueryLod([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] const IR::Value& index, [[maybe_unused]] const IR::Value& index,
[[maybe_unused]] std::string_view coords) { [[maybe_unused]] std::string_view coords) {
throw NotImplementedException("GLSL Instruction"); const auto info{inst.Flags<IR::TextureInstInfo>()};
const auto texture{Texture(ctx, info, index)};
return ctx.AddF32x4("{}=vec4(textureQueryLod({},{}),0.0,0.0);", inst, texture, coords);
} }
void EmitImageGradient([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, void EmitImageGradient([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,

View File

@ -86,10 +86,10 @@ void EmitSetZFlag(EmitContext& ctx);
void EmitSetSFlag(EmitContext& ctx); void EmitSetSFlag(EmitContext& ctx);
void EmitSetCFlag(EmitContext& ctx); void EmitSetCFlag(EmitContext& ctx);
void EmitSetOFlag(EmitContext& ctx); void EmitSetOFlag(EmitContext& ctx);
void EmitWorkgroupId(EmitContext& ctx); void EmitWorkgroupId(EmitContext& ctx, IR::Inst& inst);
void EmitLocalInvocationId(EmitContext& ctx, IR::Inst& inst); void EmitLocalInvocationId(EmitContext& ctx, IR::Inst& inst);
void EmitInvocationId(EmitContext& ctx); void EmitInvocationId(EmitContext& ctx, IR::Inst& inst);
void EmitSampleId(EmitContext& ctx); void EmitSampleId(EmitContext& ctx, IR::Inst& inst);
void EmitIsHelperInvocation(EmitContext& ctx); void EmitIsHelperInvocation(EmitContext& ctx);
void EmitYDirection(EmitContext& ctx, IR::Inst& inst); void EmitYDirection(EmitContext& ctx, IR::Inst& inst);
void EmitLoadLocal(EmitContext& ctx, std::string_view word_offset); void EmitLoadLocal(EmitContext& ctx, std::string_view word_offset);

View File

@ -203,15 +203,15 @@ void EmitSetOFlag(EmitContext& ctx) {
NotImplemented(); NotImplemented();
} }
void EmitWorkgroupId(EmitContext& ctx) { void EmitWorkgroupId(EmitContext& ctx, IR::Inst& inst) {
ctx.AddU32x3("{}=gl_WorkGroupID;", inst);
}
void EmitInvocationId(EmitContext& ctx, IR::Inst& inst) {
NotImplemented(); NotImplemented();
} }
void EmitInvocationId(EmitContext& ctx) { void EmitSampleId(EmitContext& ctx, IR::Inst& inst) {
NotImplemented();
}
void EmitSampleId(EmitContext& ctx) {
NotImplemented(); NotImplemented();
} }