Browse Source

SPIRV: Removed remap, and renamed gl_FragData_X_ to bgfx_FragDataX to workaround NV/VK driver bug.

Branimir Karadžić 7 năm trước cách đây
mục cha
commit
ae8f21c467
3 tập tin đã thay đổi với 4 bổ sung13 xóa
  1. 1 2
      src/renderer_vk.cpp
  2. 3 3
      tools/shaderc/shaderc.cpp
  3. 0 8
      tools/shaderc/shaderc_spirv.cpp

+ 1 - 2
src/renderer_vk.cpp

@@ -3529,8 +3529,7 @@ VK_DESTROY
 		const void* code = reader.getDataPtr();
 		bx::skip(&reader, shaderSize+1);
 
-		m_code = alloc( ( ( (shaderSize+3)/4)*4) );
-		bx::memSet(m_code->data, 0, m_code->size);
+		m_code = alloc(shaderSize);
 		bx::memCopy(m_code->data
 			, code
 			, shaderSize

+ 3 - 3
tools/shaderc/shaderc.cpp

@@ -759,12 +759,12 @@ namespace bgfx
 		bx::snprintf(find, sizeof(find), "gl_FragData[%d]", _idx);
 
 		char replace[32];
-		bx::snprintf(replace, sizeof(replace), "gl_FragData_%d_", _idx);
+		bx::snprintf(replace, sizeof(replace), "bgfx_FragData%d", _idx);
 
 		strReplace(_data, find, replace);
 
 		_preprocessor.writef(
-			" \\\n\t%sout vec4 gl_FragData_%d_ : SV_TARGET%d"
+			" \\\n\t%sout vec4 bgfx_FragData%d : SV_TARGET%d"
 			, _comma ? ", " : "  "
 			, _idx
 			, _idx
@@ -1523,7 +1523,7 @@ namespace bgfx
 						{
 							// GL errors when both gl_FragColor and gl_FragData is used.
 							// This will trigger the same error with HLSL compiler too.
-							preprocessor.writef("#define gl_FragColor gl_FragData_0_\n");
+							preprocessor.writef("#define gl_FragColor bgfx_FragData0\n");
 
 							// If it has gl_FragData or gl_FragColor, color target at
 							// index 0 exists, otherwise shader is not modifying color

+ 0 - 8
tools/shaderc/shaderc_spirv.cpp

@@ -688,14 +688,6 @@ namespace bgfx { namespace spirv
 				options.disableOptimizer = false;
 
 				glslang::GlslangToSpv(*intermediate, spirv, &options);
-				spv::spirvbin_t spvBin;
-				spvBin.remap(
-					  spirv
-					, 0
-					| spv::spirvbin_t::DCE_ALL
-					| spv::spirvbin_t::OPT_ALL
-					| spv::spirvbin_t::MAP_ALL
-					);
 
 				bx::Error err;
 				bx::WriterI* writer = bx::getDebugOut();