negativeFloats[ndx] = -positiveFloats[ndx];
spec.assembly =
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpSource GLSL 430\n"
"OpName %main \"main\"\n"
"OpDecorate %id BuiltIn GlobalInvocationId\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes)
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes())
- + string(s_InputOutputBuffer) +
+ + string(getComputeAsmInputOutputBuffer()) +
"%id = OpVariable %uvec3ptr Input\n"
"%zero = OpConstant %i32 0\n"
const StringTemplate shaderTemplate (
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpSource GLSL 430\n"
"OpName %main \"main\"\n"
"OpMemberDecorate %buf 0 Offset 0\n"
"OpMemberDecorate %buf2 0 Offset 0\n"
- + string(s_CommonTypes) +
+ + string(getComputeAsmCommonTypes()) +
"%buf = OpTypeStruct %f32arr\n"
"%bufptr = OpTypePointer Uniform %buf\n"
const StringTemplate shaderTemplate (
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpSource GLSL 430\n"
"OpName %main \"main\"\n"
"OpMemberDecorate %sumbuf 0 Coherent\n"
"OpMemberDecorate %sumbuf 0 Offset 0\n"
- + string(s_CommonTypes) +
+ + string(getComputeAsmCommonTypes()) +
"%buf = OpTypeStruct %i32arr\n"
"%bufptr = OpTypePointer Uniform %buf\n"
negativeFloats[ndx] = -positiveFloats[ndx];
spec.assembly =
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"%fname1 = OpString \"negateInputs.comp\"\n"
"%fname2 = OpString \"negateInputs\"\n"
"OpDecorate %id BuiltIn GlobalInvocationId\n"
- + string(s_InputOutputBufferTraits) +
+ + string(getComputeAsmInputOutputBufferTraits()) +
"OpLine %fname1 0 0\n" // At the earliest possible position
- + string(s_CommonTypes) + string(s_InputOutputBuffer) +
+ + string(getComputeAsmCommonTypes()) + string(getComputeAsmInputOutputBuffer()) +
"OpLine %fname1 0 1\n" // Multiple OpLines in sequence
"OpLine %fname2 1 0\n" // Different filenames
negativeFloats[ndx] = -positiveFloats[ndx];
spec.assembly =
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"%fname = OpString \"negateInputs.comp\"\n"
"OpDecorate %id BuiltIn GlobalInvocationId\n"
- + string(s_InputOutputBufferTraits) +
+ + string(getComputeAsmInputOutputBufferTraits()) +
"OpNoLine\n" // At the earliest possible position, without preceding OpLine
- + string(s_CommonTypes) + string(s_InputOutputBuffer) +
+ + string(getComputeAsmCommonTypes()) + string(getComputeAsmInputOutputBuffer()) +
"OpLine %fname 0 1\n"
"OpNoLine\n" // Immediately following a preceding OpLine
vector<float> inputFloats2 (numElements, 0);
vector<float> outputFloats (numElements, 0);
const StringTemplate shaderTemplate (
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpName %main \"main\"\n"
"OpName %id \"gl_GlobalInvocationID\"\n"
"OpDecorate %f32arr ArrayStride 4\n"
"OpMemberDecorate %buf 0 Offset 0\n"
- + string(s_CommonTypes) +
+ + string(getComputeAsmCommonTypes()) +
"%buf = OpTypeStruct %f32arr\n"
"%bufptr = OpTypePointer Uniform %buf\n"
}
spec.assembly =
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpName %main \"main\"\n"
"OpName %id \"gl_GlobalInvocationID\"\n"
"OpDecorate %f32arr ArrayStride 4\n"
"OpMemberDecorate %buf 0 Offset 0\n"
- + string(s_CommonTypes) +
+ + string(getComputeAsmCommonTypes()) +
"%buf = OpTypeStruct %f32arr\n"
"%bufptr = OpTypePointer Uniform %buf\n"
}
spec.assembly =
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpName %main \"main\"\n"
"OpName %id \"gl_GlobalInvocationID\"\n"
"OpDecorate %i32arr ArrayStride 4\n"
"OpMemberDecorate %buf 0 Offset 0\n"
- + string(s_CommonTypes) +
+ + string(getComputeAsmCommonTypes()) +
"%buf = OpTypeStruct %i32arr\n"
"%bufptr = OpTypePointer Uniform %buf\n"
}
spec.assembly =
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpName %main \"main\"\n"
"OpName %id \"gl_GlobalInvocationID\"\n"
"OpDecorate %i32arr ArrayStride 4\n"
"OpMemberDecorate %buf 0 Offset 0\n"
- + string(s_CommonTypes) +
+ + string(getComputeAsmCommonTypes()) +
"%buf = OpTypeStruct %i32arr\n"
"%bufptr = OpTypePointer Uniform %buf\n"
outputFloats1[ndx] = inputFloats1[ndx] + Vec4(0.f, 0.5f, 1.5f, 2.5f);
spec1.assembly =
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpName %main \"main\"\n"
"OpName %id \"gl_GlobalInvocationID\"\n"
"OpDecorate %id BuiltIn GlobalInvocationId\n"
"OpDecorate %vec4arr ArrayStride 16\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) +
"%vec4 = OpTypeVector %f32 4\n"
"%vec4ptr_u = OpTypePointer Uniform %vec4\n"
outputFloats2[ndx] = inputFloats2[ndx];
spec2.assembly =
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpName %main \"main\"\n"
"OpName %id \"gl_GlobalInvocationID\"\n"
"OpDecorate %id BuiltIn GlobalInvocationId\n"
"OpDecorate %f32arr100 ArrayStride 4\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) +
"%hundred = OpConstant %u32 100\n"
"%f32arr100 = OpTypeArray %f32 %hundred\n"
outputFloats3[ndx] = inputFloats3[ndx];
spec3.assembly =
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpName %main \"main\"\n"
"OpName %id \"gl_GlobalInvocationID\"\n"
"OpMemberDecorate %buf 2 Offset 32\n"
"OpMemberDecorate %buf 3 Offset 48\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) +
"%vec4 = OpTypeVector %f32 4\n"
"%buf = OpTypeStruct %vec4 %vec4 %vec4 %vec4\n"
outputFloats4[ndx] = -inputFloats4[ndx];
spec4.assembly =
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpName %main \"main\"\n"
"OpName %id \"gl_GlobalInvocationID\"\n"
"OpDecorate %id BuiltIn GlobalInvocationId\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) + string(s_InputOutputBuffer) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) + string(getComputeAsmInputOutputBuffer()) +
"%f32ptr_f = OpTypePointer Function %f32\n"
"%id = OpVariable %uvec3ptr Input\n"
outputFloats[ndx] = inputFloats[ndx] + 7.5f;
spec.assembly =
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpName %main \"main\"\n"
"OpName %id \"gl_GlobalInvocationID\"\n"
"OpDecorate %id BuiltIn GlobalInvocationId\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) +
"%fmat = OpTypeMatrix %fvec3 3\n"
"%three = OpConstant %u32 3\n"
"%farr = OpTypeArray %f32 %three\n"
"%fst = OpTypeStruct %f32 %f32\n"
- + string(s_InputOutputBuffer) +
+ + string(getComputeAsmInputOutputBuffer()) +
"%id = OpVariable %uvec3ptr Input\n"
"%zero = OpConstant %i32 0\n"
negativeFloats[ndx] = -positiveFloats[ndx];
spec.assembly =
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpSource GLSL 430\n"
"OpName %main \"main\"\n"
"OpDecorate %id BuiltIn GlobalInvocationId\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) +
"%u32ptr = OpTypePointer Function %u32\n"
"%uintfuint = OpTypeFunction %u32 %u32ptr\n"
"%hundred = OpConstant %u32 100\n"
"%thousand = OpConstant %u32 1000\n"
- + string(s_InputOutputBuffer) +
+ + string(getComputeAsmInputOutputBuffer()) +
// Main()
"%main = OpFunction %void None %voidf\n"
outputFloats[ndx] = inputFloats0[ndx] + inputFloats1[ndx] + inputFloats2[ndx] + inputFloats3[ndx] + inputFloats4[ndx];
spec.assembly =
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpSource GLSL 430\n"
"OpName %main \"main\"\n"
"OpGroupDecorate %group3 %indata4\n"
"OpDecorate %indata4 Binding 4\n"
- + string(s_CommonTypes) +
+ + string(getComputeAsmCommonTypes()) +
"%id = OpVariable %uvec3ptr Input\n"
"%zero = OpConstant %i32 0\n"
vector<deInt32> outputInts3 (numElements, 0);
vector<deInt32> outputInts4 (numElements, 0);
const StringTemplate shaderTemplate (
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpName %main \"main\"\n"
"OpName %id \"gl_GlobalInvocationID\"\n"
"OpDecorate %sc_1 SpecId 1\n"
"OpDecorate %i32arr ArrayStride 4\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) +
"%buf = OpTypeStruct %i32arr\n"
"%bufptr = OpTypePointer Uniform %buf\n"
ComputeShaderSpec spec;
spec.assembly =
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpName %main \"main\"\n"
"OpName %id \"gl_GlobalInvocationID\"\n"
"OpDecorate %sc_2 SpecId 2\n"
"OpDecorate %i32arr ArrayStride 4\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) +
"%ivec3 = OpTypeVector %i32 3\n"
"%buf = OpTypeStruct %i32arr\n"
}
spec1.assembly =
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpSource GLSL 430\n"
"OpName %main \"main\"\n"
"OpDecorate %id BuiltIn GlobalInvocationId\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) + string(s_InputOutputBuffer) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) + string(getComputeAsmInputOutputBuffer()) +
"%id = OpVariable %uvec3ptr Input\n"
"%zero = OpConstant %i32 0\n"
group->addChild(new SpvAsmComputeShaderCase(testCtx, "block", "out-of-order and unreachable blocks for OpPhi", spec1));
spec2.assembly =
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpName %main \"main\"\n"
"OpName %id \"gl_GlobalInvocationID\"\n"
"OpDecorate %id BuiltIn GlobalInvocationId\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) + string(s_InputOutputBuffer) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) + string(getComputeAsmInputOutputBuffer()) +
"%id = OpVariable %uvec3ptr Input\n"
"%zero = OpConstant %i32 0\n"
group->addChild(new SpvAsmComputeShaderCase(testCtx, "induction", "The usual way induction variables are handled in LLVM IR", spec2));
spec3.assembly =
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpName %main \"main\"\n"
"OpName %id \"gl_GlobalInvocationID\"\n"
"OpDecorate %id BuiltIn GlobalInvocationId\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) + string(s_InputOutputBuffer) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) + string(getComputeAsmInputOutputBuffer()) +
"%f32ptr_f = OpTypePointer Function %f32\n"
"%id = OpVariable %uvec3ptr Input\n"
}
spec.assembly =
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpSource GLSL 430\n"
"OpName %main \"main\"\n"
"OpDecorate %id BuiltIn GlobalInvocationId\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) +
"%u32ptr = OpTypePointer Function %u32\n"
"%u32ptr_input = OpTypePointer Input %u32\n"
- + string(s_InputOutputBuffer) +
+ + string(getComputeAsmInputOutputBuffer()) +
"%id = OpVariable %uvec3ptr Input\n"
"%zero = OpConstant %i32 0\n"
"OpMemberDecorate %vert_builtin_st 1 BuiltIn PointSize\n"
"OpMemberDecorate %vert_builtin_st 2 BuiltIn ClipDistance\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) + string(s_InputOutputBuffer) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) + string(getComputeAsmInputOutputBuffer()) +
"%zero = OpConstant %i32 0\n"
"%one = OpConstant %u32 1\n"
"OpDecorate %id BuiltIn GlobalInvocationId\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) + string(s_InputOutputBuffer) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) + string(getComputeAsmInputOutputBuffer()) +
"%id = OpVariable %uvec3ptr Input\n"
"%zero = OpConstant %i32 0\n"
vector<float> inputFloats (numElements, 0);
vector<float> outputFloats (numElements, 0);
const StringTemplate shaderTemplate (
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpSourceExtension \"${EXTENSION}\"\n"
"OpDecorate %id BuiltIn GlobalInvocationId\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) + string(s_InputOutputBuffer) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) + string(getComputeAsmInputOutputBuffer()) +
"%id = OpVariable %uvec3ptr Input\n"
"%zero = OpConstant %i32 0\n"
vector<float> positiveFloats (numElements, 0);
vector<float> negativeFloats (numElements, 0);
const StringTemplate shaderTemplate (
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpSource GLSL 430\n"
"OpName %main \"main\"\n"
"OpDecorate %id BuiltIn GlobalInvocationId\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) + string(s_InputOutputBuffer) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) + string(getComputeAsmInputOutputBuffer()) +
"${TYPE}\n"
"%null = OpConstantNull %type\n"
vector<float> positiveFloats (numElements, 0);
vector<float> negativeFloats (numElements, 0);
const StringTemplate shaderTemplate (
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpSource GLSL 430\n"
"OpName %main \"main\"\n"
"OpDecorate %id BuiltIn GlobalInvocationId\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) + string(s_InputOutputBuffer) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) + string(getComputeAsmInputOutputBuffer()) +
"%id = OpVariable %uvec3ptr Input\n"
"%zero = OpConstant %i32 0\n"
de::MovePtr<tcu::TestCaseGroup> group (new tcu::TestCaseGroup(testCtx, "opquantize", "Tests the OpQuantizeToF16 instruction"));
const std::string shader (
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpSource GLSL 430\n"
"OpName %main \"main\"\n"
"OpDecorate %id BuiltIn GlobalInvocationId\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) + string(s_InputOutputBuffer) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) + string(getComputeAsmInputOutputBuffer()) +
"%id = OpVariable %uvec3ptr Input\n"
"%zero = OpConstant %i32 0\n"
de::MovePtr<tcu::TestCaseGroup> group (new tcu::TestCaseGroup(testCtx, "opspecconstantop_opquantize", "Tests the OpQuantizeToF16 opcode for the OpSpecConstantOp instruction"));
const std::string shader (
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpName %main \"main\"\n"
"OpName %id \"gl_GlobalInvocationID\"\n"
"OpDecorate %sc_4 SpecId 4\n"
"OpDecorate %sc_5 SpecId 5\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) + string(s_InputOutputBuffer) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) + string(getComputeAsmInputOutputBuffer()) +
"%id = OpVariable %uvec3ptr Input\n"
"%zero = OpConstant %i32 0\n"
"OpDecorate %id BuiltIn GlobalInvocationId\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) +
"%fmat = OpTypeMatrix %fvec3 3\n"
"%ten = OpConstant %u32 10\n"
"%f32arr10 = OpTypeArray %f32 %ten\n"
"%fst = OpTypeStruct %f32 %f32\n"
- + string(s_InputOutputBuffer) +
+ + string(getComputeAsmInputOutputBuffer()) +
"%id = OpVariable %uvec3ptr Input\n"
"%zero = OpConstant %i32 0\n"
vector<float> inputFloats (numElements, 0);
vector<float> outputFloats (numElements, 0);
const StringTemplate shaderTemplate (
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpSource GLSL 430\n"
"OpName %main \"main\"\n"
"OpDecorate %id BuiltIn GlobalInvocationId\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) + string(s_InputOutputBuffer) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) + string(getComputeAsmInputOutputBuffer()) +
"%u32ptr = OpTypePointer Function %u32\n"
vector<float> inputFloats (numElements, 0);
vector<float> outputFloats (numElements, 0);
const StringTemplate shaderTemplate (
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpSource GLSL 430\n"
"OpName %main \"main\"\n"
"OpDecorate %id BuiltIn GlobalInvocationId\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) + string(s_InputOutputBuffer) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) + string(getComputeAsmInputOutputBuffer()) +
"%id = OpVariable %uvec3ptr Input\n"
"%zero = OpConstant %i32 0\n"
vector<float> inputFloats (numElements, 0);
vector<float> outputFloats (numElements, 0);
const StringTemplate shaderTemplate (
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpSource GLSL 430\n"
"OpName %main \"main\"\n"
"OpDecorate %id BuiltIn GlobalInvocationId\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) + string(s_InputOutputBuffer) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) + string(getComputeAsmInputOutputBuffer()) +
"%f32f = OpTypeFunction %f32\n"
"%id = OpVariable %uvec3ptr Input\n"
vector<float> inputFloats (numElements, 0);
vector<float> outputFloats (numElements, 0);
const StringTemplate shaderTemplate (
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpSource GLSL 430\n"
"OpName %main \"main\"\n"
"OpDecorate %id BuiltIn GlobalInvocationId\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) + string(s_InputOutputBuffer) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) + string(getComputeAsmInputOutputBuffer()) +
"%f32ptr_f = OpTypePointer Function %f32\n"
vector<float> positiveFloats (numElements, 0);
vector<float> negativeFloats (numElements, 0);
const StringTemplate shaderTemplate (
- string(s_ShaderPreamble) +
+ string(getComputeAsmShaderPreamble()) +
"OpSource GLSL 430\n"
"OpName %main \"main\"\n"
"OpDecorate %id BuiltIn GlobalInvocationId\n"
- + string(s_InputOutputBufferTraits) + string(s_CommonTypes) + string(s_InputOutputBuffer) +
+ + string(getComputeAsmInputOutputBufferTraits()) + string(getComputeAsmCommonTypes()) + string(getComputeAsmInputOutputBuffer()) +
"${TYPE}\n"