Fix tessellation pipeline setup

This commit is contained in:
Jack Andersen 2018-10-16 17:26:07 -10:00
parent 9adf481c8e
commit 7d1be415c6
3 changed files with 27 additions and 16 deletions

View File

@ -588,6 +588,9 @@ class D3D11ShaderPipeline : public GraphicsDataNode<IShaderPipeline>
if (auto* s = evaluation.cast<D3D11ShaderStage>()) if (auto* s = evaluation.cast<D3D11ShaderStage>())
s->shader(m_dShader); s->shader(m_dShader);
if (control && evaluation)
m_topology = D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST + info.patchSize - 1;
D3D11_CULL_MODE cullMode; D3D11_CULL_MODE cullMode;
switch (info.culling) switch (info.culling)
{ {

View File

@ -839,7 +839,11 @@ protected:
CullMode m_culling; CullMode m_culling;
uint32_t m_patchSize = 0; uint32_t m_patchSize = 0;
mutable GLint m_uniLocs[BOO_GLSL_MAX_UNIFORM_COUNT]; mutable GLint m_uniLocs[BOO_GLSL_MAX_UNIFORM_COUNT];
GLShaderPipeline(const ObjToken<BaseGraphicsData>& parent, const AdditionalPipelineInfo& info) GLShaderPipeline(const ObjToken<BaseGraphicsData>& parent,
ObjToken<IShaderStage> vertex, ObjToken<IShaderStage> fragment,
ObjToken<IShaderStage> geometry, ObjToken<IShaderStage> control,
ObjToken<IShaderStage> evaluation, const VertexFormatInfo& vtxFmt,
const AdditionalPipelineInfo& info)
: GraphicsDataNode<IShaderPipeline>(parent) : GraphicsDataNode<IShaderPipeline>(parent)
{ {
std::fill(std::begin(m_uniLocs), std::end(m_uniLocs), -1); std::fill(std::begin(m_uniLocs), std::end(m_uniLocs), -1);
@ -865,6 +869,19 @@ protected:
m_culling = info.culling; m_culling = info.culling;
m_drawPrim = PRIMITIVE_TABLE[int(info.prim)]; m_drawPrim = PRIMITIVE_TABLE[int(info.prim)];
m_patchSize = info.patchSize; m_patchSize = info.patchSize;
m_vertex = vertex;
m_fragment = fragment;
m_geometry = geometry;
m_control = control;
m_evaluation = evaluation;
if (control && evaluation)
m_drawPrim = GL_PATCHES;
m_elements.reserve(vtxFmt.elementCount);
for (size_t i=0 ; i<vtxFmt.elementCount ; ++i)
m_elements.push_back(vtxFmt.elements[i]);
} }
public: public:
~GLShaderPipeline() { if (m_prog) glDeleteProgram(m_prog); } ~GLShaderPipeline() { if (m_prog) glDeleteProgram(m_prog); }
@ -1037,20 +1054,8 @@ GLDataFactory::Context::newShaderPipeline(ObjToken<IShaderStage> vertex, ObjToke
int(factory.m_maxPatchSize), int(additionalInfo.patchSize)); int(factory.m_maxPatchSize), int(additionalInfo.patchSize));
} }
ObjToken<IShaderPipeline> retval(new GLShaderPipeline(m_data, additionalInfo)); return {new GLShaderPipeline(m_data, vertex, fragment, geometry, control,
GLShaderPipeline& shader = *retval.cast<GLShaderPipeline>(); evaluation, vtxFmt, additionalInfo)};
shader.m_vertex = vertex;
shader.m_fragment = fragment;
shader.m_geometry = geometry;
shader.m_control = control;
shader.m_evaluation = evaluation;
shader.m_elements.reserve(vtxFmt.elementCount);
for (size_t i=0 ; i<vtxFmt.elementCount ; ++i)
shader.m_elements.push_back(vtxFmt.elements[i]);
return retval;
} }
struct GLShaderDataBinding : GraphicsDataNode<IShaderDataBinding> struct GLShaderDataBinding : GraphicsDataNode<IShaderDataBinding>

View File

@ -2230,7 +2230,10 @@ protected:
m_colorWrite(info.colorWrite), m_alphaWrite(info.alphaWrite), m_colorWrite(info.colorWrite), m_alphaWrite(info.alphaWrite),
m_overwriteAlpha(info.overwriteAlpha), m_culling(info.culling), m_overwriteAlpha(info.overwriteAlpha), m_culling(info.culling),
m_patchSize(info.patchSize) m_patchSize(info.patchSize)
{} {
if (control && evaluation)
m_prim = Primitive::Patches;
}
public: public:
~VulkanShaderPipeline() ~VulkanShaderPipeline()
{ {