Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.

Conversation

Jorgemagic
Copy link
Contributor

Hi @gongminmin,

In this pull request I added several things:

Added Explicit resource bindings in OpenGL translation

HLSL

Texture2D DiffuseTexture : register(t0);
SamplerState Sampler : register(s0);
Texture2D DiffuseTexture2 : register(t1);

Produced explicit layout bindings in GLSL

layout(binding = 0) uniform sampler2D SPIRV_Cross_CombinedDiffuseTextureSampler;
layout(binding = 1) uniform sampler2D SPIRV_Cross_CombinedDiffuseTexture2Sampler;

This ensures the resource bindings are the same that in original HLSL.

More flexible load dependencies (dxcompiler) on windows

Before:
m_dxcompilerDll = ::LoadLibraryA(dllName);
Issue: Only search dxcompiler library in executable path and system paths, now is possible load library from ShaderConductor library path.

Included libShaderConductorWrapper to cmake compilation

Now the AzurePipeline artifacts will include libdxcompiler, libShaderConductor, and libShaderConductorWrapper libraries.

@@ -128,7 +128,23 @@ namespace
const char* functionName = "DxcCreateInstance";

#ifdef _WIN32
m_dxcompilerDll = ::LoadLibraryA(dllName);
HMODULE hm = NULL;
if (GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCSTR) "DllMain",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(LPCSTR)"DllMain"
can be changed to
TEXT("DllMain")
to make it compatible to both MBCS and UNICODE. Or just use GetModuleHandleExA without C-style case to DllMain. Same as GetModuleFileName below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think that it is interesting.

@@ -22,24 +22,28 @@ add_dependencies(${DLL_NAME} ShaderConductor)

set_target_properties(${DLL_NAME} PROPERTIES FOLDER "Wrapper")

set(CSHARP_TEST CSharpPinvoke)
if(SC_WITH_CSHARP)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be:
if(NOT SC_WITH_CSHARP)
return()
endif()
to avoid indent most lines in this file.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants