|
|
@ -90,14 +90,20 @@ void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr, Scal |
|
|
ctx.Add("MOV.F {}.x,{}.position.{};", inst, ctx.attrib_name, swizzle); |
|
|
ctx.Add("MOV.F {}.x,{}.position.{};", inst, ctx.attrib_name, swizzle); |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
case IR::Attribute::TessellationEvaluationPointU: |
|
|
|
|
|
case IR::Attribute::TessellationEvaluationPointV: |
|
|
|
|
|
ctx.Add("MOV.F {}.x,vertex.tesscoord.{};", inst, swizzle); |
|
|
|
|
|
|
|
|
case IR::Attribute::ColorFrontDiffuseR: |
|
|
|
|
|
case IR::Attribute::ColorFrontDiffuseG: |
|
|
|
|
|
case IR::Attribute::ColorFrontDiffuseB: |
|
|
|
|
|
case IR::Attribute::ColorFrontDiffuseA: |
|
|
|
|
|
ctx.Add("MOV.F {}.x,{}.color.{};", inst, ctx.attrib_name, swizzle); |
|
|
break; |
|
|
break; |
|
|
case IR::Attribute::PointSpriteS: |
|
|
case IR::Attribute::PointSpriteS: |
|
|
case IR::Attribute::PointSpriteT: |
|
|
case IR::Attribute::PointSpriteT: |
|
|
ctx.Add("MOV.F {}.x,{}.pointcoord.{};", inst, ctx.attrib_name, swizzle); |
|
|
ctx.Add("MOV.F {}.x,{}.pointcoord.{};", inst, ctx.attrib_name, swizzle); |
|
|
break; |
|
|
break; |
|
|
|
|
|
case IR::Attribute::TessellationEvaluationPointU: |
|
|
|
|
|
case IR::Attribute::TessellationEvaluationPointV: |
|
|
|
|
|
ctx.Add("MOV.F {}.x,vertex.tesscoord.{};", inst, swizzle); |
|
|
|
|
|
break; |
|
|
case IR::Attribute::InstanceId: |
|
|
case IR::Attribute::InstanceId: |
|
|
ctx.Add("MOV.S {}.x,{}.instance;", inst, ctx.attrib_name); |
|
|
ctx.Add("MOV.S {}.x,{}.instance;", inst, ctx.attrib_name); |
|
|
break; |
|
|
break; |
|
|
@ -121,7 +127,27 @@ void EmitSetAttribute(EmitContext& ctx, IR::Attribute attr, ScalarF32 value, |
|
|
ctx.Add("MOV.F out_attr{}[0].{},{};", index, swizzle, value); |
|
|
ctx.Add("MOV.F out_attr{}[0].{},{};", index, swizzle, value); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
if (attr >= IR::Attribute::FixedFncTexture0S && attr <= IR::Attribute::FixedFncTexture9R) { |
|
|
|
|
|
const u32 index{ |
|
|
|
|
|
(static_cast<u32>(attr) - static_cast<u32>(IR::Attribute::FixedFncTexture0S)) / 4}; |
|
|
|
|
|
ctx.Add("MOV.F result.texcoord[{}].{},{};", index, swizzle, value); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
switch (attr) { |
|
|
switch (attr) { |
|
|
|
|
|
case IR::Attribute::Layer: |
|
|
|
|
|
if (ctx.stage == Stage::Geometry || ctx.profile.support_viewport_index_layer_non_geometry) { |
|
|
|
|
|
ctx.Add("MOV.F result.layer.x,{};", value); |
|
|
|
|
|
} else { |
|
|
|
|
|
// LOG_WARNING
|
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
case IR::Attribute::ViewportIndex: |
|
|
|
|
|
if (ctx.stage == Stage::Geometry || ctx.profile.support_viewport_index_layer_non_geometry) { |
|
|
|
|
|
ctx.Add("MOV.F result.viewport.x,{};", value); |
|
|
|
|
|
} else { |
|
|
|
|
|
// LOG_WARNING
|
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
case IR::Attribute::PointSize: |
|
|
case IR::Attribute::PointSize: |
|
|
ctx.Add("MOV.F result.pointsize.x,{};", value); |
|
|
ctx.Add("MOV.F result.pointsize.x,{};", value); |
|
|
break; |
|
|
break; |
|
|
@ -131,6 +157,33 @@ void EmitSetAttribute(EmitContext& ctx, IR::Attribute attr, ScalarF32 value, |
|
|
case IR::Attribute::PositionW: |
|
|
case IR::Attribute::PositionW: |
|
|
ctx.Add("MOV.F result.position.{},{};", swizzle, value); |
|
|
ctx.Add("MOV.F result.position.{},{};", swizzle, value); |
|
|
break; |
|
|
break; |
|
|
|
|
|
case IR::Attribute::ColorFrontDiffuseR: |
|
|
|
|
|
case IR::Attribute::ColorFrontDiffuseG: |
|
|
|
|
|
case IR::Attribute::ColorFrontDiffuseB: |
|
|
|
|
|
case IR::Attribute::ColorFrontDiffuseA: |
|
|
|
|
|
ctx.Add("MOV.F result.color.{},{};", swizzle, value); |
|
|
|
|
|
break; |
|
|
|
|
|
case IR::Attribute::ColorFrontSpecularR: |
|
|
|
|
|
case IR::Attribute::ColorFrontSpecularG: |
|
|
|
|
|
case IR::Attribute::ColorFrontSpecularB: |
|
|
|
|
|
case IR::Attribute::ColorFrontSpecularA: |
|
|
|
|
|
ctx.Add("MOV.F result.color.secondary.{},{};", swizzle, value); |
|
|
|
|
|
break; |
|
|
|
|
|
case IR::Attribute::ColorBackDiffuseR: |
|
|
|
|
|
case IR::Attribute::ColorBackDiffuseG: |
|
|
|
|
|
case IR::Attribute::ColorBackDiffuseB: |
|
|
|
|
|
case IR::Attribute::ColorBackDiffuseA: |
|
|
|
|
|
ctx.Add("MOV.F result.color.back.{},{};", swizzle, value); |
|
|
|
|
|
break; |
|
|
|
|
|
case IR::Attribute::ColorBackSpecularR: |
|
|
|
|
|
case IR::Attribute::ColorBackSpecularG: |
|
|
|
|
|
case IR::Attribute::ColorBackSpecularB: |
|
|
|
|
|
case IR::Attribute::ColorBackSpecularA: |
|
|
|
|
|
ctx.Add("MOV.F result.color.back.secondary.{},{};", swizzle, value); |
|
|
|
|
|
break; |
|
|
|
|
|
case IR::Attribute::FogCoordinate: |
|
|
|
|
|
ctx.Add("MOV.F result.fogcoord.x,{};", value); |
|
|
|
|
|
break; |
|
|
case IR::Attribute::ClipDistance0: |
|
|
case IR::Attribute::ClipDistance0: |
|
|
case IR::Attribute::ClipDistance1: |
|
|
case IR::Attribute::ClipDistance1: |
|
|
case IR::Attribute::ClipDistance2: |
|
|
case IR::Attribute::ClipDistance2: |
|
|
@ -143,20 +196,6 @@ void EmitSetAttribute(EmitContext& ctx, IR::Attribute attr, ScalarF32 value, |
|
|
ctx.Add("MOV.F result.clip[{}].x,{};", index, value); |
|
|
ctx.Add("MOV.F result.clip[{}].x,{};", index, value); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
case IR::Attribute::Layer: |
|
|
|
|
|
if (ctx.stage == Stage::Geometry || ctx.profile.support_viewport_index_layer_non_geometry) { |
|
|
|
|
|
ctx.Add("MOV.F result.layer.x,{};", value); |
|
|
|
|
|
} else { |
|
|
|
|
|
// LOG_WARNING
|
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
case IR::Attribute::ViewportIndex: |
|
|
|
|
|
if (ctx.stage == Stage::Geometry || ctx.profile.support_viewport_index_layer_non_geometry) { |
|
|
|
|
|
ctx.Add("MOV.F result.viewport.x,{};", value); |
|
|
|
|
|
} else { |
|
|
|
|
|
// LOG_WARNING
|
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
default: |
|
|
throw NotImplementedException("Set attribute {}", attr); |
|
|
throw NotImplementedException("Set attribute {}", attr); |
|
|
} |
|
|
} |
|
|
|