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

Format code for PR #6236 #9

Merged
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
2 changes: 1 addition & 1 deletion tools/gfx/d3d12/d3d12-shader-program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ using namespace Slang;

Result ShaderProgramImpl::createShaderModule(
slang::EntryPointReflection* entryPointInfo,
List<ComPtr<ISlangBlob> > kernelCodes)
List<ComPtr<ISlangBlob>> kernelCodes)
{
ShaderBinary shaderBin;
shaderBin.stage = entryPointInfo->getStage();
Expand Down
2 changes: 1 addition & 1 deletion tools/gfx/d3d12/d3d12-shader-program.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ShaderProgramImpl : public ShaderProgramBase

virtual Result createShaderModule(
slang::EntryPointReflection* entryPointInfo,
List<ComPtr<ISlangBlob> > kernelCodes) override;
List<ComPtr<ISlangBlob>> kernelCodes) override;
};

} // namespace d3d12
Expand Down
2 changes: 1 addition & 1 deletion tools/gfx/metal/metal-shader-program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ShaderProgramImpl::~ShaderProgramImpl() {}

Result ShaderProgramImpl::createShaderModule(
slang::EntryPointReflection* entryPointInfo,
Slang::List<ComPtr<ISlangBlob> > kernelCodes)
Slang::List<ComPtr<ISlangBlob>> kernelCodes)
{
Module module;
module.stage = entryPointInfo->getStage();
Expand Down
2 changes: 1 addition & 1 deletion tools/gfx/metal/metal-shader-program.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ShaderProgramImpl : public ShaderProgramBase

virtual Result createShaderModule(
slang::EntryPointReflection* entryPointInfo,
Slang::List<ComPtr<ISlangBlob> > kernelCodes) override;
Slang::List<ComPtr<ISlangBlob>> kernelCodes) override;
};


Expand Down
8 changes: 4 additions & 4 deletions tools/gfx/renderer-shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,7 @@ Result ShaderProgramBase::compileShaders(RendererBase* device)
{
auto stage = entryPointInfo->getStage();

List<ComPtr<ISlangBlob> > kernelCodes;
List<ComPtr<ISlangBlob>> kernelCodes;
ComPtr<ISlangBlob> kernelCode;
{
ComPtr<ISlangBlob> diagnostics;
Expand Down Expand Up @@ -1179,8 +1179,8 @@ Result ShaderProgramBase::compileShaders(RendererBase* device)
{
ComPtr<slang::IBlob> diagnosticsBlob;
auto result = precompileService->getPrecompiledTargetCode(
SLANG_SPIRV,
spirv.writeRef(),
SLANG_SPIRV,
spirv.writeRef(),
diagnosticsBlob.writeRef());
if (result == SLANG_OK)
{
Expand Down Expand Up @@ -1235,7 +1235,7 @@ Result ShaderProgramBase::compileShaders(RendererBase* device)

Result ShaderProgramBase::createShaderModule(
slang::EntryPointReflection* entryPointInfo,
Slang::List<ComPtr<ISlangBlob> > kernelCodes)
Slang::List<ComPtr<ISlangBlob>> kernelCodes)
{
SLANG_UNUSED(entryPointInfo);
SLANG_UNUSED(kernelCodes);
Expand Down
2 changes: 1 addition & 1 deletion tools/gfx/renderer-shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ class ShaderProgramBase : public IShaderProgram, public Slang::ComObject
Slang::Result compileShaders(RendererBase* device);
virtual Slang::Result createShaderModule(
slang::EntryPointReflection* entryPointInfo,
Slang::List<Slang::ComPtr<ISlangBlob> > kernelCodes);
Slang::List<Slang::ComPtr<ISlangBlob>> kernelCodes);

virtual SLANG_NO_THROW slang::TypeReflection* SLANG_MCALL
findTypeByName(const char* name) override
Expand Down
20 changes: 10 additions & 10 deletions tools/gfx/vulkan/vk-shader-program.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// vk-shader-program.cpp
#include "vk-shader-program.h"

#include "external/spirv-tools/include/spirv-tools/linker.hpp"
#include "vk-device.h"
#include "vk-util.h"

#include "external/spirv-tools/include/spirv-tools/linker.hpp"

namespace gfx
{

Expand Down Expand Up @@ -71,14 +70,14 @@ VkPipelineShaderStageCreateInfo ShaderProgramImpl::compileEntryPoint(
return shaderStageCreateInfo;
}

static ComPtr<ISlangBlob> LinkWithSPIRVTools(List<ComPtr<ISlangBlob> > kernelCodes)
static ComPtr<ISlangBlob> LinkWithSPIRVTools(List<ComPtr<ISlangBlob>> kernelCodes)
{
spvtools::Context context(SPV_ENV_UNIVERSAL_1_5);
spvtools::LinkerOptions options;
spvtools::MessageConsumer consumer = [](spv_message_level_t level,
const char* source,
const spv_position_t& position,
const char* message)
const char* source,
const spv_position_t& position,
const char* message)
{
printf("SPIRV-TOOLS: %s\n", message);
printf("SPIRV-TOOLS: %s\n", source);
Expand Down Expand Up @@ -108,16 +107,17 @@ static ComPtr<ISlangBlob> LinkWithSPIRVTools(List<ComPtr<ISlangBlob> > kernelCod

// Replace kernel code with linked binary
// Creates a new blob with the linked binary
linkedKernelCode = RawBlob::create(linked_binary.data(), linked_binary.size() * sizeof(uint32_t));
linkedKernelCode =
RawBlob::create(linked_binary.data(), linked_binary.size() * sizeof(uint32_t));

return linkedKernelCode;
}
Result ShaderProgramImpl::createShaderModule(
slang::EntryPointReflection* entryPointInfo,
List<ComPtr<ISlangBlob>> kernelCodes)
{
//for (auto kernelCode : kernelCodes)
// m_codeBlobs.add(kernelCode);
// for (auto kernelCode : kernelCodes)
// m_codeBlobs.add(kernelCode);

ComPtr<ISlangBlob> linkedKernel = LinkWithSPIRVTools(kernelCodes);
m_codeBlobs.add(linkedKernel);
Expand All @@ -130,7 +130,7 @@ Result ShaderProgramImpl::createShaderModule(
linkedKernel,
(VkShaderStageFlagBits)VulkanUtil::getShaderStage(entryPointInfo->getStage()),
shaderModule));

m_entryPointNames.add(realEntryPointName);
m_modules.add(shaderModule);
return SLANG_OK;
Expand Down
2 changes: 1 addition & 1 deletion tools/gfx/vulkan/vk-shader-program.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ShaderProgramImpl : public ShaderProgramBase

virtual Result createShaderModule(
slang::EntryPointReflection* entryPointInfo,
List<ComPtr<ISlangBlob> > kernelCodes) override;
List<ComPtr<ISlangBlob>> kernelCodes) override;
};


Expand Down
Loading