mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-11-04 00:49:02 -06:00 
			
		
		
		
	glsl: Implement more instructions used by SMO
This commit is contained in:
		@@ -148,6 +148,10 @@ void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr,
 | 
			
		||||
            throw NotImplementedException("Get Position for stage {}", ctx.stage);
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
    case IR::Attribute::PointSpriteS:
 | 
			
		||||
    case IR::Attribute::PointSpriteT:
 | 
			
		||||
        ctx.AddF32("{}=gl_PointCoord.{};", inst, swizzle);
 | 
			
		||||
        break;
 | 
			
		||||
    case IR::Attribute::InstanceId:
 | 
			
		||||
        ctx.AddF32("{}=intBitsToFloat(gl_InstanceID);", inst);
 | 
			
		||||
        break;
 | 
			
		||||
@@ -174,7 +178,7 @@ void EmitSetAttribute(EmitContext& ctx, IR::Attribute attr, std::string_view val
 | 
			
		||||
    }
 | 
			
		||||
    switch (attr) {
 | 
			
		||||
    case IR::Attribute::PointSize:
 | 
			
		||||
        ctx.Add("gl_Pointsize={};", value);
 | 
			
		||||
        ctx.Add("gl_PointSize={};", value);
 | 
			
		||||
        break;
 | 
			
		||||
    case IR::Attribute::PositionX:
 | 
			
		||||
    case IR::Attribute::PositionY:
 | 
			
		||||
 
 | 
			
		||||
@@ -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,
 | 
			
		||||
                       [[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,
 | 
			
		||||
 
 | 
			
		||||
@@ -376,7 +376,9 @@ void EmitImageQueryDimensions([[maybe_unused]] EmitContext& ctx, [[maybe_unused]
 | 
			
		||||
void EmitImageQueryLod([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
 | 
			
		||||
                       [[maybe_unused]] const IR::Value& index,
 | 
			
		||||
                       [[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,
 | 
			
		||||
 
 | 
			
		||||
@@ -86,10 +86,10 @@ void EmitSetZFlag(EmitContext& ctx);
 | 
			
		||||
void EmitSetSFlag(EmitContext& ctx);
 | 
			
		||||
void EmitSetCFlag(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 EmitInvocationId(EmitContext& ctx);
 | 
			
		||||
void EmitSampleId(EmitContext& ctx);
 | 
			
		||||
void EmitInvocationId(EmitContext& ctx, IR::Inst& inst);
 | 
			
		||||
void EmitSampleId(EmitContext& ctx, IR::Inst& inst);
 | 
			
		||||
void EmitIsHelperInvocation(EmitContext& ctx);
 | 
			
		||||
void EmitYDirection(EmitContext& ctx, IR::Inst& inst);
 | 
			
		||||
void EmitLoadLocal(EmitContext& ctx, std::string_view word_offset);
 | 
			
		||||
 
 | 
			
		||||
@@ -203,15 +203,15 @@ void EmitSetOFlag(EmitContext& ctx) {
 | 
			
		||||
    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();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void EmitInvocationId(EmitContext& ctx) {
 | 
			
		||||
    NotImplemented();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void EmitSampleId(EmitContext& ctx) {
 | 
			
		||||
void EmitSampleId(EmitContext& ctx, IR::Inst& inst) {
 | 
			
		||||
    NotImplemented();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user