public MakeArrayType ( ITypeHLSL elementType, EmitValHLSL elementCount ) : ITypeHLSL | ||
elementType | ITypeHLSL | |
elementCount | EmitValHLSL | |
Résultat | ITypeHLSL |
public override void EmitImplSetup() { constantElement = GetElement( "Constant" ); InitBlock.AppendComment( "D3D11 Geometry Shader" ); var gsEnabledAttr = FindAttribute( constantElement, "__D3D11GeometryShaderEnabled" ); if( gsEnabledAttr == null ) { return; } var uniformElement = GetElement( "Uniform" ); var fineVertexElement = GetElement( "FineVertex" ); var rasterVertexElement = GetElement( "RasterVertex" ); var geometryInputElement = GetElement( "GeometryInput" ); var geometryOutputElement = GetElement( "GeometryOutput" ); hlslContext = new EmitContextHLSL( SharedHLSL, Range, this.EmitClass.GetName() ); var entryPointSpan = hlslContext.EntryPointSpan; var gsInstanceCount = GetAttribute( constantElement, "GS_InstanceCount" ); var gsInputVertexCount = GetAttribute( constantElement, "GS_InputVertexCount" ); var gsMaxOutputVertexCount = GetAttribute( constantElement, "GS_MaxOutputVertexCount" ); var gsInstanceID = GetAttribute( geometryInputElement, "GS_InstanceID" ); var gsInputVertices = GetAttribute( geometryInputElement, "GS_InputVertices" ); var gsOutputStream = GetAttribute( geometryOutputElement, "GS_OutputStream" ); hlslContext.GenerateConnectorType(fineVertexElement); hlslContext.GenerateConnectorType(rasterVertexElement); entryPointSpan.WriteLine( "[instance({0})]", hlslContext.EmitAttrLit( gsInstanceCount ) ); entryPointSpan.WriteLine( "[maxvertexcount({0})]", hlslContext.EmitAttrLit( gsMaxOutputVertexCount ) ); entryPointSpan.WriteLine( "void main(" ); bool first = true; // \todo: "triangle" or appropriate prefix... hlslContext.DeclareParamAndBind( gsInputVertices, hlslContext.MakeArrayType( hlslContext.GenerateConnectorType(fineVertexElement), hlslContext.EmitAttribRef(gsInputVertexCount, null)), null, ref first, entryPointSpan, prefix: "triangle "); hlslContext.DeclareParamAndBind( gsOutputStream, null, ref first, entryPointSpan, prefix: "inout "); hlslContext.DeclareParamAndBind( gsInstanceID, "SV_GSInstanceID", ref first, entryPointSpan ); entryPointSpan.WriteLine( "\t)" ); entryPointSpan.WriteLine( "{" ); var gi2go = hlslContext.EmitTempRecordCtor( entryPointSpan, geometryInputElement, GetAttribute(geometryOutputElement, "__gi2go")); hlslContext.BindAttr( GetAttribute(rasterVertexElement, "__gi2rv"), gi2go); var output = hlslContext.EmitConnectorCtor( entryPointSpan, geometryOutputElement ); entryPointSpan.WriteLine( "}" ); hlslContext.EmitConstantBufferDecl(); EmitShaderSetup( hlslContext, "gs_5_0", "Geometry", "GS" ); }