X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fglsl%2Fspirv.cpp;h=b2eac3f0fe1925b11cc586e3e3485d19735ca388;hp=85312bc4edb67760f2e87d0591a0e7499707d114;hb=79db78e77054cd93e69123b3b6495a561f5cbd10;hpb=7272d97c23eedb3850661deec964c4a9c96337fe diff --git a/source/glsl/spirv.cpp b/source/glsl/spirv.cpp index 85312bc4..b2eac3f0 100644 --- a/source/glsl/spirv.cpp +++ b/source/glsl/spirv.cpp @@ -187,6 +187,14 @@ SpirVGenerator::BuiltinSemantic SpirVGenerator::get_builtin_semantic(const strin return BUILTIN_INVOCATION_ID; else if(name=="gl_Layer") return BUILTIN_LAYER; + else if(name=="gl_TessLevelOuter") + return BUILTIN_TESS_LEVEL_OUTER; + else if(name=="gl_TessLevelInner") + return BUILTIN_TESS_LEVEL_INNER; + else if(name=="gl_TessCoord") + return BUILTIN_TESS_COORD; + else if(name=="gl_PatchVerticesIn") + return BUILTIN_PATCH_VERTICES; else if(name=="gl_FragCoord") return BUILTIN_FRAG_COORD; else if(name=="gl_PointCoord") @@ -1775,6 +1783,8 @@ void SpirVGenerator::visit(VariableDeclaration &var) writer.write_op_decorate(var_id, DECO_FLAT); if(var.sampling=="centroid") writer.write_op_decorate(var_id, DECO_CENTROID); + if(var.sampling=="patch") + writer.write_op_decorate(var_id, DECO_PATCH); if(init_id && current_function) { @@ -1793,6 +1803,8 @@ void SpirVGenerator::visit_entry_point(FunctionDeclaration &func, Id func_id) switch(stage->type) { case Stage::VERTEX: writer.write(0); break; + case Stage::TESS_CONTROL: writer.write(1); break; + case Stage::TESS_EVAL: writer.write(2); break; case Stage::GEOMETRY: writer.write(3); break; case Stage::FRAGMENT: writer.write(4); break; case Stage::COMPUTE: writer.write(5); break; @@ -1819,6 +1831,10 @@ void SpirVGenerator::visit_entry_point(FunctionDeclaration &func, Id func_id) use_capability(CAP_GEOMETRY); writer.write_op(content.exec_modes, OP_EXECUTION_MODE, func_id, EXEC_INVOCATIONS, 1); } + else if(stage->type==Stage::TESS_CONTROL || stage->type==Stage::TESS_EVAL) + { + use_capability(CAP_TESSELLATION); + } unsigned local_size[3] = { 0, 1, 1 }; @@ -1837,12 +1853,26 @@ void SpirVGenerator::visit_entry_point(FunctionDeclaration &func, Id func_id) writer.write_op(content.exec_modes, OP_EXECUTION_MODE, func_id, EXEC_TRIANGLES); else if(q.name=="triangles_adjacency") writer.write_op(content.exec_modes, OP_EXECUTION_MODE, func_id, EXEC_INPUT_TRIANGLES_ADJACENCY); + else if(q.name=="quads") + writer.write_op(content.exec_modes, OP_EXECUTION_MODE, func_id, EXEC_QUADS); + else if(q.name=="isolines") + writer.write_op(content.exec_modes, OP_EXECUTION_MODE, func_id, EXEC_ISOLINES); else if(q.name=="line_strip") writer.write_op(content.exec_modes, OP_EXECUTION_MODE, func_id, EXEC_OUTPUT_LINE_STRIP); else if(q.name=="triangle_strip") writer.write_op(content.exec_modes, OP_EXECUTION_MODE, func_id, EXEC_OUTPUT_TRIANGLE_STRIP); - else if(q.name=="max_vertices") + else if(q.name=="max_vertices" || q.name=="vertices") writer.write_op(content.exec_modes, OP_EXECUTION_MODE, func_id, EXEC_OUTPUT_VERTICES, q.value); + else if(q.name=="cw") + writer.write_op(content.exec_modes, OP_EXECUTION_MODE, func_id, EXEC_VERTEX_ORDER_CW); + else if(q.name=="ccw") + writer.write_op(content.exec_modes, OP_EXECUTION_MODE, func_id, EXEC_VERTEX_ORDER_CCW); + else if(q.name=="equal_spacing") + writer.write_op(content.exec_modes, OP_EXECUTION_MODE, func_id, EXEC_SPACING_EQUAL); + else if(q.name=="fractional_even_spacing") + writer.write_op(content.exec_modes, OP_EXECUTION_MODE, func_id, EXEC_SPACING_FRACTIONAL_EVEN); + else if(q.name=="fractional_odd_spacing") + writer.write_op(content.exec_modes, OP_EXECUTION_MODE, func_id, EXEC_SPACING_FRACTIONAL_ODD); else if(q.name=="local_size_x") local_size[0] = q.value; else if(q.name=="local_size_y")