Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit Resource Bindings in OpenGL #51

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

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.

Source/CMakeLists.txt Show resolved Hide resolved
@@ -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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants