shader
This commit is contained in:
@@ -8,8 +8,6 @@
|
||||
#include "asset/AssetManager.hpp"
|
||||
#include "game/Game.hpp"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
const std::string ShaderLoader::ASSET_TYPE = "shader";
|
||||
@@ -44,9 +42,9 @@ void ShaderLoader::updateSync() {
|
||||
// Get list of entry points and create components
|
||||
int32_t definedEntryPointCount = module->getDefinedEntryPointCount();
|
||||
IComponentType** components = new IComponentType*[definedEntryPointCount + 1];
|
||||
int32_t j = 0;
|
||||
int32_t componentCount = 0;
|
||||
|
||||
components[j++] = module;
|
||||
components[componentCount++] = module;
|
||||
|
||||
for(auto i = 0; i < definedEntryPointCount; i++) {
|
||||
Slang::ComPtr<IEntryPoint> ep;
|
||||
@@ -60,15 +58,20 @@ void ShaderLoader::updateSync() {
|
||||
auto name = ep->getFunctionReflection()->getName();
|
||||
std::cout << "Found entry point: " << name << std::endl;
|
||||
entryPoints.push_back(std::string(name));
|
||||
components[j++] = ep;
|
||||
components[componentCount++] = ep;
|
||||
}
|
||||
|
||||
// Create the composite component type
|
||||
sm->session->createCompositeComponentType(
|
||||
components,
|
||||
sizeof(components) / sizeof(components[0]),
|
||||
program.writeRef()
|
||||
componentCount,
|
||||
program.writeRef(),
|
||||
diagnostics.writeRef()
|
||||
);
|
||||
if(diagnostics) {
|
||||
assertUnreachable("%s\n", (const char*) diagnostics->getBufferPointer());
|
||||
return;
|
||||
}
|
||||
|
||||
// Link the program.
|
||||
auto result = program->link(linkedProgram.writeRef(), diagnostics.writeRef());
|
||||
@@ -77,19 +80,7 @@ void ShaderLoader::updateSync() {
|
||||
return;
|
||||
}
|
||||
|
||||
// result
|
||||
Slang::ComPtr<IBlob> blob;
|
||||
auto result2 = linkedProgram->getEntryPointCode(
|
||||
0,
|
||||
0,
|
||||
blob.writeRef(),
|
||||
diagnostics.writeRef()
|
||||
);
|
||||
|
||||
if(diagnostics) {
|
||||
assertUnreachable("%s\n", (const char*) diagnostics->getBufferPointer());
|
||||
}
|
||||
|
||||
delete [] components;
|
||||
this->state = ShaderLoaderState::LOADED;
|
||||
this->loaded = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user