Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ const static float32_t2 tc[3] = {

[[vk::constant_id(0)]] const uint32_t SwapchainTransform = 0;

#ifndef NBL_EXT_FULLSCREEN_TRIANGLE_VS_ENTRYPOINT
#define NBL_EXT_FULLSCREEN_TRIANGLE_VS_ENTRYPOINT main
#endif

[shader("vertex")]
SVertexAttributes main()
SVertexAttributes NBL_EXT_FULLSCREEN_TRIANGLE_VS_ENTRYPOINT()
Comment on lines +24 to +29

Choose a reason for hiding this comment

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

this is truly weird, couldn't we just name mangle the entrypoint? like __nbl__hlsl__ext__FullScreenTriangle__vertex_main ?

{
using namespace ::nbl::hlsl::glsl;

Expand All @@ -33,4 +37,4 @@ SVertexAttributes main()
SVertexAttributes retval;
retval.uv = tc[gl_VertexIndex()];
return retval;
}
}
4 changes: 2 additions & 2 deletions include/nbl/builtin/hlsl/surface_transform.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#ifndef _NBL_BUILTIN_HLSL_SURFACE_TRANSFORM_INCLUDED_
#define _NBL_BUILTIN_HLSL_SURFACE_TRANSFORM_INCLUDED_
#include <nbl/builtin/hlsl/limits.hlsl>
#include <nbl/builtin/hlsl/cpp_compat.hlsl>
#include <nbl/builtin/hlsl/glsl_compat/core.hlsl>

namespace nbl
Expand Down Expand Up @@ -174,8 +175,7 @@ inline float32_t2 applyToNDC(const FLAG_BITS transform, const float32_t2 ndc)
template<typename TwoColumns>
TwoColumns applyToDerivatives(const FLAG_BITS transform, TwoColumns dDx_dDy)
{
using namespace glsl; // IN HLSL mode, C++ doens't need this to access `inverse`
return mul(inverse(transformMatrix(transform)),dDx_dDy);
return mul(::nbl::hlsl::inverse(transformMatrix(transform)),dDx_dDy);
}

}
Expand Down
11 changes: 9 additions & 2 deletions include/nbl/ext/FullScreenTriangle/FullScreenTriangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ struct ProtoPipeline final
inline ProtoPipeline(asset::IAssetManager* assMan, video::ILogicalDevice* device, system::ILogger* logger=nullptr)
{
m_vxShader = createDefaultVertexShader(assMan,device,logger);

Choose a reason for hiding this comment

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

is there no way for this extension to have a builtin archive where the vertex shader is a precompiled .spv ?

Copy link
Member Author

Choose a reason for hiding this comment

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

it's easy, if you want separate .spv I can get you one

m_vxEntryPoint = "main";
}

inline ProtoPipeline(core::smart_refctd_ptr<asset::IShader> vertexShader, const char* vertexEntryPoint="main") : m_vxShader(std::move(vertexShader))
{
m_vxEntryPoint = vertexEntryPoint ? vertexEntryPoint : "main";
}

inline operator bool() const {return m_vxShader.get();}
Expand Down Expand Up @@ -63,7 +69,7 @@ struct ProtoPipeline final

IGPUGraphicsPipeline::SCreationParams params[1];
params[0].layout = layout;
params[0].vertexShader = { .shader = m_vxShader.get(), .entryPoint = "main", .entries = &specConstants };
params[0].vertexShader = { .shader = m_vxShader.get(), .entryPoint = m_vxEntryPoint, .entries = &specConstants };
params[0].fragmentShader = fragShader;
params[0].cached = {
.vertexInput = {}, // The Full Screen Triangle doesn't use any HW vertex input state
Expand All @@ -82,6 +88,7 @@ struct ProtoPipeline final


core::smart_refctd_ptr<asset::IShader> m_vxShader;
std::string m_vxEntryPoint = "main";
// The default is correct for us
constexpr static inline asset::SRasterizationParams DefaultRasterParams = {
.faceCullingMode = asset::EFCM_NONE,
Expand All @@ -103,4 +110,4 @@ static inline bool recordDrawCall(video::IGPUCommandBuffer* commandBuffer)
return commandBuffer->draw(VERTEX_COUNT,INSTANCE_COUNT,0,0);
}
}
#endif
#endif
2 changes: 1 addition & 1 deletion src/nbl/asset/utils/CHLSLCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ static DxcCompilationResult dxcCompile(const CHLSLCompiler* compiler, nbl::asset
DxcBuffer sourceBuffer;
sourceBuffer.Ptr = src->GetBufferPointer();
sourceBuffer.Size = src->GetBufferSize();
sourceBuffer.Encoding = 0;
sourceBuffer.Encoding = CP_UTF8;

ComPtr<IDxcResult> compileResult;
res = dxc->m_dxcCompiler->Compile(&sourceBuffer, args, argCount, nullptr, IID_PPV_ARGS(compileResult.GetAddressOf()));
Expand Down
Loading