mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-07 09:01:57 +00:00
- removed array length() function from shadowmap shader
Array's length() function is not yet supported by SPIRV-cross and MoltenVK Its usage was replaced by explicit nodes count value passed as uniform
This commit is contained in:
parent
cddc945d5d
commit
791d29b732
6 changed files with 13 additions and 3 deletions
|
@ -195,6 +195,7 @@ void FGLRenderer::UpdateShadowMap()
|
||||||
|
|
||||||
mShadowMapShader->Bind();
|
mShadowMapShader->Bind();
|
||||||
mShadowMapShader->Uniforms->ShadowmapQuality = gl_shadowmap_quality;
|
mShadowMapShader->Uniforms->ShadowmapQuality = gl_shadowmap_quality;
|
||||||
|
mShadowMapShader->Uniforms->NodesCount = screen->mShadowMap.NodesCount();
|
||||||
mShadowMapShader->Uniforms.Set();
|
mShadowMapShader->Uniforms.Set();
|
||||||
|
|
||||||
glViewport(0, 0, gl_shadowmap_quality, 1024);
|
glViewport(0, 0, gl_shadowmap_quality, 1024);
|
||||||
|
|
|
@ -53,6 +53,7 @@ public:
|
||||||
const void *Lines() const { return treelines.Data(); }
|
const void *Lines() const { return treelines.Data(); }
|
||||||
size_t NodesSize() const { return nodes.Size() * sizeof(AABBTreeNode); }
|
size_t NodesSize() const { return nodes.Size() * sizeof(AABBTreeNode); }
|
||||||
size_t LinesSize() const { return treelines.Size() * sizeof(AABBTreeLine); }
|
size_t LinesSize() const { return treelines.Size() * sizeof(AABBTreeLine); }
|
||||||
|
unsigned int NodesCount() const { return nodes.Size(); }
|
||||||
|
|
||||||
const void *DynamicNodes() const { return nodes.Data() + dynamicStartNode; }
|
const void *DynamicNodes() const { return nodes.Data() + dynamicStartNode; }
|
||||||
const void *DynamicLines() const { return treelines.Data() + dynamicStartLine; }
|
const void *DynamicLines() const { return treelines.Data() + dynamicStartLine; }
|
||||||
|
|
|
@ -34,6 +34,12 @@ public:
|
||||||
UpdateCycles.Clock();
|
UpdateCycles.Clock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int NodesCount() const
|
||||||
|
{
|
||||||
|
assert(mAABBTree);
|
||||||
|
return mAABBTree->NodesCount();
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void CollectLights();
|
void CollectLights();
|
||||||
bool ValidateAABBTree(FLevelLocals *lev);
|
bool ValidateAABBTree(FLevelLocals *lev);
|
||||||
|
|
|
@ -845,6 +845,7 @@ void PPShadowMap::Update(PPRenderState *renderstate)
|
||||||
{
|
{
|
||||||
ShadowMapUniforms uniforms;
|
ShadowMapUniforms uniforms;
|
||||||
uniforms.ShadowmapQuality = (float)gl_shadowmap_quality;
|
uniforms.ShadowmapQuality = (float)gl_shadowmap_quality;
|
||||||
|
uniforms.NodesCount = screen->mShadowMap.NodesCount();
|
||||||
|
|
||||||
renderstate->PushGroup("shadowmap");
|
renderstate->PushGroup("shadowmap");
|
||||||
|
|
||||||
|
|
|
@ -762,16 +762,17 @@ public:
|
||||||
struct ShadowMapUniforms
|
struct ShadowMapUniforms
|
||||||
{
|
{
|
||||||
float ShadowmapQuality;
|
float ShadowmapQuality;
|
||||||
float Padding0, Padding1, Padding2;
|
int NodesCount;
|
||||||
|
float Padding0, Padding1;
|
||||||
|
|
||||||
static std::vector<UniformFieldDesc> Desc()
|
static std::vector<UniformFieldDesc> Desc()
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
{
|
{
|
||||||
{ "ShadowmapQuality", UniformType::Float, offsetof(ShadowMapUniforms, ShadowmapQuality) },
|
{ "ShadowmapQuality", UniformType::Float, offsetof(ShadowMapUniforms, ShadowmapQuality) },
|
||||||
|
{ "NodesCount", UniformType::Int, offsetof(ShadowMapUniforms, NodesCount) },
|
||||||
{ "Padding0", UniformType::Float, offsetof(ShadowMapUniforms, Padding0) },
|
{ "Padding0", UniformType::Float, offsetof(ShadowMapUniforms, Padding0) },
|
||||||
{ "Padding1", UniformType::Float, offsetof(ShadowMapUniforms, Padding1) },
|
{ "Padding1", UniformType::Float, offsetof(ShadowMapUniforms, Padding1) },
|
||||||
{ "Padding2", UniformType::Float, offsetof(ShadowMapUniforms, Padding2) },
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -111,7 +111,7 @@ float rayTest(vec2 ray_start, vec2 ray_end)
|
||||||
|
|
||||||
int stack[32];
|
int stack[32];
|
||||||
int stack_pos = 1;
|
int stack_pos = 1;
|
||||||
stack[0] = nodes.length() - 1;
|
stack[0] = NodesCount - 1;
|
||||||
while (stack_pos > 0)
|
while (stack_pos > 0)
|
||||||
{
|
{
|
||||||
int node_index = stack[stack_pos - 1];
|
int node_index = stack[stack_pos - 1];
|
||||||
|
|
Loading…
Reference in a new issue