This commit is contained in:
Mikko Strandborg 2016-11-17 09:52:55 +02:00
parent 117eb98b61
commit 23cd014fd4
3 changed files with 14 additions and 4 deletions

View File

@ -72,12 +72,13 @@ void HLSLCrossCompilerContext::ClearDependencyData()
case PIXEL_SHADER: case PIXEL_SHADER:
{ {
psDependencies->ClearCrossDependencyData(); psDependencies->ClearCrossDependencyData();
break;
} }
case HULL_SHADER: case HULL_SHADER:
{ {
psDependencies->eTessPartitioning = TESSELLATOR_PARTITIONING_UNDEFINED; psDependencies->eTessPartitioning = TESSELLATOR_PARTITIONING_UNDEFINED;
psDependencies->eTessOutPrim = TESSELLATOR_OUTPUT_UNDEFINED; psDependencies->eTessOutPrim = TESSELLATOR_OUTPUT_UNDEFINED;
break; break;
} }
default: default:
break; break;

View File

@ -62,7 +62,16 @@ HLSLCC_API int HLSLCC_APIENTRY TranslateHLSLFromMem(const char* shader,
sContext.psShader = psShader.get(); sContext.psShader = psShader.get();
sContext.flags = flags; sContext.flags = flags;
sContext.psDependencies = dependencies;
// If dependencies == NULL, we'll create a dummy object for it so that there's always something there.
std::auto_ptr<GLSLCrossDependencyData> depPtr(NULL);
if (dependencies == NULL)
{
depPtr.reset(new GLSLCrossDependencyData());
sContext.psDependencies = depPtr.get();
}
else
sContext.psDependencies = dependencies;
for (i = 0; i < psShader->asPhases.size(); ++i) for (i = 0; i < psShader->asPhases.size(); ++i)
{ {

View File

@ -402,7 +402,7 @@ static void ReadResources(const uint32_t* pui32Tokens,//in
psShaderInfo->psResourceBindings.clear(); psShaderInfo->psResourceBindings.clear();
psShaderInfo->psResourceBindings.resize(ui32NumResourceBindings); psShaderInfo->psResourceBindings.resize(ui32NumResourceBindings);
psResBindings = &psShaderInfo->psResourceBindings[0]; psResBindings = ui32NumResourceBindings == 0 ? NULL : &psShaderInfo->psResourceBindings[0];
for(i=0; i < ui32NumResourceBindings; ++i) for(i=0; i < ui32NumResourceBindings; ++i)
{ {
@ -415,7 +415,7 @@ static void ReadResources(const uint32_t* pui32Tokens,//in
psShaderInfo->psConstantBuffers.clear(); psShaderInfo->psConstantBuffers.clear();
psShaderInfo->psConstantBuffers.resize(ui32NumConstantBuffers); psShaderInfo->psConstantBuffers.resize(ui32NumConstantBuffers);
psConstantBuffers = &psShaderInfo->psConstantBuffers[0]; psConstantBuffers = ui32NumConstantBuffers == 0 ? NULL : &psShaderInfo->psConstantBuffers[0];
for(i=0; i < ui32NumConstantBuffers; ++i) for(i=0; i < ui32NumConstantBuffers; ++i)
{ {