mirror of
				https://github.com/yuzu-emu/yuzu.git
				synced 2025-11-04 09:03:42 +00:00 
			
		
		
		
	Merge pull request #2524 from ReinUsesLisp/fixup-extension
gl_shader_gen: Always declare extensions after the version declaration
This commit is contained in:
		
						commit
						2eb4d27c48
					
				@ -35,6 +35,7 @@ Device::Device(std::nullptr_t) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
bool Device::TestVariableAoffi() {
 | 
					bool Device::TestVariableAoffi() {
 | 
				
			||||||
    const GLchar* AOFFI_TEST = R"(#version 430 core
 | 
					    const GLchar* AOFFI_TEST = R"(#version 430 core
 | 
				
			||||||
 | 
					// This is a unit test, please ignore me on apitrace bug reports.
 | 
				
			||||||
uniform sampler2D tex;
 | 
					uniform sampler2D tex;
 | 
				
			||||||
uniform ivec2 variable_offset;
 | 
					uniform ivec2 variable_offset;
 | 
				
			||||||
void main() {
 | 
					void main() {
 | 
				
			||||||
 | 
				
			|||||||
@ -170,7 +170,8 @@ GLShader::ProgramResult CreateProgram(const Device& device, Maxwell::ShaderProgr
 | 
				
			|||||||
CachedProgram SpecializeShader(const std::string& code, const GLShader::ShaderEntries& entries,
 | 
					CachedProgram SpecializeShader(const std::string& code, const GLShader::ShaderEntries& entries,
 | 
				
			||||||
                               Maxwell::ShaderProgram program_type, BaseBindings base_bindings,
 | 
					                               Maxwell::ShaderProgram program_type, BaseBindings base_bindings,
 | 
				
			||||||
                               GLenum primitive_mode, bool hint_retrievable = false) {
 | 
					                               GLenum primitive_mode, bool hint_retrievable = false) {
 | 
				
			||||||
    std::string source = "#version 430 core\n";
 | 
					    std::string source = "#version 430 core\n"
 | 
				
			||||||
 | 
					                         "#extension GL_ARB_separate_shader_objects : enable\n\n";
 | 
				
			||||||
    source += fmt::format("#define EMULATION_UBO_BINDING {}\n", base_bindings.cbuf++);
 | 
					    source += fmt::format("#define EMULATION_UBO_BINDING {}\n", base_bindings.cbuf++);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (const auto& cbuf : entries.const_buffers) {
 | 
					    for (const auto& cbuf : entries.const_buffers) {
 | 
				
			||||||
 | 
				
			|||||||
@ -19,8 +19,7 @@ static constexpr u32 PROGRAM_OFFSET{10};
 | 
				
			|||||||
ProgramResult GenerateVertexShader(const Device& device, const ShaderSetup& setup) {
 | 
					ProgramResult GenerateVertexShader(const Device& device, const ShaderSetup& setup) {
 | 
				
			||||||
    const std::string id = fmt::format("{:016x}", setup.program.unique_identifier);
 | 
					    const std::string id = fmt::format("{:016x}", setup.program.unique_identifier);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    std::string out = "#extension GL_ARB_separate_shader_objects : enable\n\n";
 | 
					    std::string out = "// Shader Unique Id: VS" + id + "\n\n";
 | 
				
			||||||
    out += "// Shader Unique Id: VS" + id + "\n\n";
 | 
					 | 
				
			||||||
    out += GetCommonDeclarations();
 | 
					    out += GetCommonDeclarations();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    out += R"(
 | 
					    out += R"(
 | 
				
			||||||
@ -82,8 +81,7 @@ void main() {
 | 
				
			|||||||
ProgramResult GenerateGeometryShader(const Device& device, const ShaderSetup& setup) {
 | 
					ProgramResult GenerateGeometryShader(const Device& device, const ShaderSetup& setup) {
 | 
				
			||||||
    const std::string id = fmt::format("{:016x}", setup.program.unique_identifier);
 | 
					    const std::string id = fmt::format("{:016x}", setup.program.unique_identifier);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    std::string out = "#extension GL_ARB_separate_shader_objects : enable\n\n";
 | 
					    std::string out = "// Shader Unique Id: GS" + id + "\n\n";
 | 
				
			||||||
    out += "// Shader Unique Id: GS" + id + "\n\n";
 | 
					 | 
				
			||||||
    out += GetCommonDeclarations();
 | 
					    out += GetCommonDeclarations();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    out += R"(
 | 
					    out += R"(
 | 
				
			||||||
@ -113,8 +111,7 @@ void main() {
 | 
				
			|||||||
ProgramResult GenerateFragmentShader(const Device& device, const ShaderSetup& setup) {
 | 
					ProgramResult GenerateFragmentShader(const Device& device, const ShaderSetup& setup) {
 | 
				
			||||||
    const std::string id = fmt::format("{:016x}", setup.program.unique_identifier);
 | 
					    const std::string id = fmt::format("{:016x}", setup.program.unique_identifier);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    std::string out = "#extension GL_ARB_separate_shader_objects : enable\n\n";
 | 
					    std::string out = "// Shader Unique Id: FS" + id + "\n\n";
 | 
				
			||||||
    out += "// Shader Unique Id: FS" + id + "\n\n";
 | 
					 | 
				
			||||||
    out += GetCommonDeclarations();
 | 
					    out += GetCommonDeclarations();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    out += R"(
 | 
					    out += R"(
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user