diff options
Diffstat (limited to 'src/shader_recompiler/backend/spirv/emit_context.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/spirv/emit_context.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_context.cpp b/src/shader_recompiler/backend/spirv/emit_context.cpp index a98e08392..3e8899f53 100644 --- a/src/shader_recompiler/backend/spirv/emit_context.cpp +++ b/src/shader_recompiler/backend/spirv/emit_context.cpp | |||
| @@ -136,7 +136,7 @@ Id DefineInput(EmitContext& ctx, Id type, bool per_invocation, | |||
| 136 | break; | 136 | break; |
| 137 | case Stage::Geometry: | 137 | case Stage::Geometry: |
| 138 | if (per_invocation) { | 138 | if (per_invocation) { |
| 139 | const u32 num_vertices{NumVertices(ctx.profile.input_topology)}; | 139 | const u32 num_vertices{NumVertices(ctx.runtime_info.input_topology)}; |
| 140 | type = ctx.TypeArray(type, ctx.Const(num_vertices)); | 140 | type = ctx.TypeArray(type, ctx.Const(num_vertices)); |
| 141 | } | 141 | } |
| 142 | break; | 142 | break; |
| @@ -161,8 +161,8 @@ void DefineGenericOutput(EmitContext& ctx, size_t index, std::optional<u32> invo | |||
| 161 | while (element < 4) { | 161 | while (element < 4) { |
| 162 | const u32 remainder{4 - element}; | 162 | const u32 remainder{4 - element}; |
| 163 | const TransformFeedbackVarying* xfb_varying{}; | 163 | const TransformFeedbackVarying* xfb_varying{}; |
| 164 | if (!ctx.profile.xfb_varyings.empty()) { | 164 | if (!ctx.runtime_info.xfb_varyings.empty()) { |
| 165 | xfb_varying = &ctx.profile.xfb_varyings[base_attr_index + element]; | 165 | xfb_varying = &ctx.runtime_info.xfb_varyings[base_attr_index + element]; |
| 166 | xfb_varying = xfb_varying && xfb_varying->components > 0 ? xfb_varying : nullptr; | 166 | xfb_varying = xfb_varying && xfb_varying->components > 0 ? xfb_varying : nullptr; |
| 167 | } | 167 | } |
| 168 | const u32 num_components{xfb_varying ? xfb_varying->components : remainder}; | 168 | const u32 num_components{xfb_varying ? xfb_varying->components : remainder}; |
| @@ -208,7 +208,7 @@ Id GetAttributeType(EmitContext& ctx, AttributeType type) { | |||
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | std::optional<AttrInfo> AttrTypes(EmitContext& ctx, u32 index) { | 210 | std::optional<AttrInfo> AttrTypes(EmitContext& ctx, u32 index) { |
| 211 | const AttributeType type{ctx.profile.generic_input_types.at(index)}; | 211 | const AttributeType type{ctx.runtime_info.generic_input_types.at(index)}; |
| 212 | switch (type) { | 212 | switch (type) { |
| 213 | case AttributeType::Float: | 213 | case AttributeType::Float: |
| 214 | return AttrInfo{ctx.input_f32, ctx.F32[1], false}; | 214 | return AttrInfo{ctx.input_f32, ctx.F32[1], false}; |
| @@ -441,13 +441,15 @@ void VectorTypes::Define(Sirit::Module& sirit_ctx, Id base_type, std::string_vie | |||
| 441 | } | 441 | } |
| 442 | } | 442 | } |
| 443 | 443 | ||
| 444 | EmitContext::EmitContext(const Profile& profile_, IR::Program& program, Bindings& binding) | 444 | EmitContext::EmitContext(const Profile& profile_, const RuntimeInfo& runtime_info_, |
| 445 | : Sirit::Module(profile_.supported_spirv), profile{profile_}, stage{program.stage} { | 445 | IR::Program& program, Bindings& bindings) |
| 446 | : Sirit::Module(profile_.supported_spirv), profile{profile_}, | ||
| 447 | runtime_info{runtime_info_}, stage{program.stage} { | ||
| 446 | const bool is_unified{profile.unified_descriptor_binding}; | 448 | const bool is_unified{profile.unified_descriptor_binding}; |
| 447 | u32& uniform_binding{is_unified ? binding.unified : binding.uniform_buffer}; | 449 | u32& uniform_binding{is_unified ? bindings.unified : bindings.uniform_buffer}; |
| 448 | u32& storage_binding{is_unified ? binding.unified : binding.storage_buffer}; | 450 | u32& storage_binding{is_unified ? bindings.unified : bindings.storage_buffer}; |
| 449 | u32& texture_binding{is_unified ? binding.unified : binding.texture}; | 451 | u32& texture_binding{is_unified ? bindings.unified : bindings.texture}; |
| 450 | u32& image_binding{is_unified ? binding.unified : binding.image}; | 452 | u32& image_binding{is_unified ? bindings.unified : bindings.image}; |
| 451 | AddCapability(spv::Capability::Shader); | 453 | AddCapability(spv::Capability::Shader); |
| 452 | DefineCommonTypes(program.info); | 454 | DefineCommonTypes(program.info); |
| 453 | DefineCommonConstants(); | 455 | DefineCommonConstants(); |
| @@ -1211,7 +1213,7 @@ void EmitContext::DefineInputs(const Info& info) { | |||
| 1211 | if (!generic.used) { | 1213 | if (!generic.used) { |
| 1212 | continue; | 1214 | continue; |
| 1213 | } | 1215 | } |
| 1214 | const AttributeType input_type{profile.generic_input_types[index]}; | 1216 | const AttributeType input_type{runtime_info.generic_input_types[index]}; |
| 1215 | if (input_type == AttributeType::Disabled) { | 1217 | if (input_type == AttributeType::Disabled) { |
| 1216 | continue; | 1218 | continue; |
| 1217 | } | 1219 | } |
| @@ -1256,7 +1258,7 @@ void EmitContext::DefineOutputs(const IR::Program& program) { | |||
| 1256 | if (info.stores_position || stage == Stage::VertexB) { | 1258 | if (info.stores_position || stage == Stage::VertexB) { |
| 1257 | output_position = DefineOutput(*this, F32[4], invocations, spv::BuiltIn::Position); | 1259 | output_position = DefineOutput(*this, F32[4], invocations, spv::BuiltIn::Position); |
| 1258 | } | 1260 | } |
| 1259 | if (info.stores_point_size || profile.fixed_state_point_size) { | 1261 | if (info.stores_point_size || runtime_info.fixed_state_point_size) { |
| 1260 | if (stage == Stage::Fragment) { | 1262 | if (stage == Stage::Fragment) { |
| 1261 | throw NotImplementedException("Storing PointSize in fragment stage"); | 1263 | throw NotImplementedException("Storing PointSize in fragment stage"); |
| 1262 | } | 1264 | } |