Advertisement

geometry shaders and input patches

Started by August 07, 2018 12:11 PM
0 comments, last by Koen 6 years, 5 months ago

Has anyone ever tried to draw with one of the D3D11_PRIMITIVE_TOPOLOGY_XX_CONTROL_POINT_PATCHLIST primitive topologies, when only a vertex, geometry and pixel shader are active? Practical Rendering and Computation with Direct3D 11microsoft's documentation for the InputPatch hlsl type and this (old) blog post seem to suggest it should be possible. But when I try, an error occurs when drawing:


D3D11 ERROR: ID3D11DeviceContext::Draw: Rasterization Unit is enabled (PixelShader is not NULL or Depth/Stencil test is enabled and RasterizedStream is not D3D11_SO_NO_RASTERIZED_STREAM) but the input topology is Patch Control Points.  You need either a Hull Shader and Domain Shader, or a Geometry Shader. [ EXECUTION ERROR #349: DEVICE_DRAW_INPUTLAYOUT_NOT_SET]
D3D11: **BREAK** enabled for the previous message, which was: [ ERROR EXECUTION #349: DEVICE_DRAW_INPUTLAYOUT_NOT_SET ]

I'm sure I did bind a geometry shader (and renderdoc agrees with me ?).

The OpenGL and Vulkan documentation seem to explicitly *not* allow this, though, so maybe it's simply not possible ? If you've ever managed to do this, were there some special details to take into account to get it working? Thanks!

 

PS: for completeness, here's my test shader code, although I don't think it does anything special:


//
// vertex shader
//

struct VertexShaderInputData {
  float4 pos : position;
};
struct VertexShaderOutputData {
  float4 pos : position;
};
VertexShaderOutputData vs_main(VertexShaderInputData inputData) {
  VertexShaderOutputData outputData;
  outputData.pos = inputData.pos; 
  return outputData;
}

//
// geometry shader
//

struct GeometryShaderInputData {
  float4 pos : position;
};
struct GeometryShaderOutputData {
  float4 pos : SV_Position;
};
[maxvertexcount(8)]
void gs_main(in InputPatch<GeometryShaderInputData, 8> inputData,
             uint input_patch_id : SV_PrimitiveID,
             uint gs_instance_id : SV_GSInstanceID,
             inout TriangleStream<GeometryShaderOutputData> output_stream) {
  GeometryShaderOutputData output_vertex;

  output_vertex.pos = inputData[0].pos;
  output_stream.Append(output_vertex);
  ...and so on...
}

//
// pixel shader
//

struct PixelShaderOutputData {
  float4 color : SV_Target0;
};
PixelShaderOutputData main() {
  PixelShaderOutputData outputData;
  outputData.color = float4(1.0,1.0,1.0,1.0); 
  return outputData;
}

 

This topic is closed to new replies.

Advertisement