| 86 | } |
| 87 | |
| 88 | bool |
| 89 | HgiPipelineCreationTestDriver::_CreateShaderProgram() |
| 90 | { |
| 91 | HgiShaderFunctionDesc vertDesc; |
| 92 | vertDesc.debugName = TfToken("Vertex"); |
| 93 | vertDesc.shaderStage = HgiShaderStageVertex; |
| 94 | HgiShaderFunctionAddStageInput( |
| 95 | &vertDesc, "position", "vec4", "position"); |
| 96 | HgiShaderFunctionAddStageInput( |
| 97 | &vertDesc, "uvIn", "vec2"); |
| 98 | HgiShaderFunctionAddStageOutput( |
| 99 | &vertDesc, "gl_Position", "vec4", "position"); |
| 100 | HgiShaderFunctionAddStageOutput( |
| 101 | &vertDesc, "uvOut", "vec2"); |
| 102 | |
| 103 | HgiShaderFunctionDesc fragDesc; |
| 104 | fragDesc.debugName = TfToken("Fragment"); |
| 105 | fragDesc.shaderStage = HgiShaderStageFragment; |
| 106 | HgiShaderFunctionAddStageInput( |
| 107 | &fragDesc, "uvOut", "vec2"); |
| 108 | HgiShaderFunctionAddStageOutput( |
| 109 | &fragDesc, "hd_FragColor", "vec4", "color"); |
| 110 | |
| 111 | vertDesc.shaderCode = glslfx_vertShaderStr.c_str(); |
| 112 | HgiShaderFunctionHandle vertFn = _hgi->CreateShaderFunction(vertDesc); |
| 113 | |
| 114 | fragDesc.shaderCode = glslfx_fragShaderStr.c_str(); |
| 115 | HgiShaderFunctionHandle fragFn = _hgi->CreateShaderFunction(fragDesc); |
| 116 | |
| 117 | HgiShaderProgramDesc programDesc; |
| 118 | programDesc.debugName = TfToken("FullscreenTriangle").GetString(); |
| 119 | programDesc.shaderFunctions.push_back(std::move(vertFn)); |
| 120 | programDesc.shaderFunctions.push_back(std::move(fragFn)); |
| 121 | _shaderProgram = _hgi->CreateShaderProgram(programDesc); |
| 122 | |
| 123 | if (!_shaderProgram->IsValid() || !vertFn->IsValid() || |
| 124 | !fragFn->IsValid()) { |
| 125 | TF_CODING_ERROR("Failed to create shader program"); |
| 126 | _PrintCompileErrors(); |
| 127 | _DestroyShaderProgram(); |
| 128 | return false; |
| 129 | } |
| 130 | |
| 131 | return true; |
| 132 | } |
| 133 | |
| 134 | bool |
| 135 | HgiPipelineCreationTestDriver::_CreatePipeline() |
nothing calls this directly
no test coverage detected