Browse Source

Address format clang

nce_cpp
vonchenplus 4 years ago
parent
commit
8fe519b656
  1. 72
      src/shader_recompiler/frontend/maxwell/translate_program.cpp
  2. 2
      src/video_core/renderer_opengl/gl_shader_cache.cpp
  3. 2
      src/video_core/renderer_vulkan/vk_pipeline_cache.cpp

72
src/shader_recompiler/frontend/maxwell/translate_program.cpp

@ -128,6 +128,42 @@ void AddNVNStorageBuffers(IR::Program& program) {
}); });
} }
} }
bool IsLegacyAttribute(IR::Attribute attribute) {
return (attribute >= IR::Attribute::ColorFrontDiffuseR &&
attribute <= IR::Attribute::ColorBackSpecularA) ||
attribute == IR::Attribute::FogCoordinate ||
(attribute >= IR::Attribute::FixedFncTexture0S &&
attribute <= IR::Attribute::FixedFncTexture9Q);
}
std::map<IR::Attribute, IR::Attribute> GenerateLegacyToGenericMappings(
const VaryingState& state, std::queue<IR::Attribute> ununsed_generics) {
std::map<IR::Attribute, IR::Attribute> mapping;
for (size_t index = 0; index < 4; ++index) {
auto attr = IR::Attribute::ColorFrontDiffuseR + index * 4;
if (state.AnyComponent(attr)) {
for (size_t i = 0; i < 4; ++i) {
mapping.insert({attr + i, ununsed_generics.front() + i});
}
ununsed_generics.pop();
}
}
if (state[IR::Attribute::FogCoordinate]) {
mapping.insert({IR::Attribute::FogCoordinate, ununsed_generics.front()});
ununsed_generics.pop();
}
for (size_t index = 0; index < IR::NUM_FIXEDFNCTEXTURE; ++index) {
auto attr = IR::Attribute::FixedFncTexture0S + index * 4;
if (state.AnyComponent(attr)) {
for (size_t i = 0; i < 4; ++i) {
mapping.insert({attr + i, ununsed_generics.front() + i});
}
ununsed_generics.pop();
}
}
return mapping;
}
} // Anonymous namespace } // Anonymous namespace
IR::Program TranslateProgram(ObjectPool<IR::Inst>& inst_pool, ObjectPool<IR::Block>& block_pool, IR::Program TranslateProgram(ObjectPool<IR::Inst>& inst_pool, ObjectPool<IR::Block>& block_pool,
@ -227,42 +263,6 @@ IR::Program MergeDualVertexPrograms(IR::Program& vertex_a, IR::Program& vertex_b
return result; return result;
} }
bool IsLegacyAttribute(IR::Attribute attribute) {
return (attribute >= IR::Attribute::ColorFrontDiffuseR &&
attribute <= IR::Attribute::ColorBackSpecularA) ||
attribute == IR::Attribute::FogCoordinate ||
(attribute >= IR::Attribute::FixedFncTexture0S &&
attribute <= IR::Attribute::FixedFncTexture9Q);
}
std::map<IR::Attribute, IR::Attribute> GenerateLegacyToGenericMappings(
const VaryingState& state, std::queue<IR::Attribute> ununsed_generics) {
std::map<IR::Attribute, IR::Attribute> mapping;
for (size_t index = 0; index < 4; ++index) {
auto attr = IR::Attribute::ColorFrontDiffuseR + index * 4;
if (state.AnyComponent(attr)) {
for (size_t i = 0; i < 4; ++i) {
mapping.insert({attr + i, ununsed_generics.front() + i});
}
ununsed_generics.pop();
}
}
if (state[IR::Attribute::FogCoordinate]) {
mapping.insert({IR::Attribute::FogCoordinate, ununsed_generics.front()});
ununsed_generics.pop();
}
for (size_t index = 0; index < IR::NUM_FIXED_FNC_TEXTURES; ++index) {
auto attr = IR::Attribute::FixedFncTexture0S + index * 4;
if (state.AnyComponent(attr)) {
for (size_t i = 0; i < 4; ++i) {
mapping.insert({attr + i, ununsed_generics.front() + i});
}
ununsed_generics.pop();
}
}
return mapping;
}
void ConvertLegacyToGeneric(IR::Program& program, const Shader::RuntimeInfo& runtime_info) { void ConvertLegacyToGeneric(IR::Program& program, const Shader::RuntimeInfo& runtime_info) {
auto& stores = program.info.stores; auto& stores = program.info.stores;
if (stores.Legacy()) { if (stores.Legacy()) {

2
src/video_core/renderer_opengl/gl_shader_cache.cpp

@ -42,9 +42,9 @@ namespace {
using Shader::Backend::GLASM::EmitGLASM; using Shader::Backend::GLASM::EmitGLASM;
using Shader::Backend::GLSL::EmitGLSL; using Shader::Backend::GLSL::EmitGLSL;
using Shader::Backend::SPIRV::EmitSPIRV; using Shader::Backend::SPIRV::EmitSPIRV;
using Shader::Maxwell::ConvertLegacyToGeneric;
using Shader::Maxwell::MergeDualVertexPrograms; using Shader::Maxwell::MergeDualVertexPrograms;
using Shader::Maxwell::TranslateProgram; using Shader::Maxwell::TranslateProgram;
using Shader::Maxwell::ConvertLegacyToGeneric;
using VideoCommon::ComputeEnvironment; using VideoCommon::ComputeEnvironment;
using VideoCommon::FileEnvironment; using VideoCommon::FileEnvironment;
using VideoCommon::GenericEnvironment; using VideoCommon::GenericEnvironment;

2
src/video_core/renderer_vulkan/vk_pipeline_cache.cpp

@ -48,9 +48,9 @@ MICROPROFILE_DECLARE(Vulkan_PipelineCache);
namespace { namespace {
using Shader::Backend::SPIRV::EmitSPIRV; using Shader::Backend::SPIRV::EmitSPIRV;
using Shader::Maxwell::ConvertLegacyToGeneric;
using Shader::Maxwell::MergeDualVertexPrograms; using Shader::Maxwell::MergeDualVertexPrograms;
using Shader::Maxwell::TranslateProgram; using Shader::Maxwell::TranslateProgram;
using Shader::Maxwell::ConvertLegacyToGeneric;
using VideoCommon::ComputeEnvironment; using VideoCommon::ComputeEnvironment;
using VideoCommon::FileEnvironment; using VideoCommon::FileEnvironment;
using VideoCommon::GenericEnvironment; using VideoCommon::GenericEnvironment;

Loading…
Cancel
Save