rsx/vp: Decide default return values in case of undefined attributes based on location ID

- Different default values should be returned for different attributes
This commit is contained in:
kd-11 2017-12-03 08:31:57 +03:00
parent 90c2324e47
commit 9853027f72

View file

@ -278,9 +278,35 @@ namespace glsl
OS << "vec4 read_location(int location)\n";
OS << "{\n";
OS << " attribute_desc desc = fetch_desc(location);\n";
OS << " //if attribute is disabled return 1 (makes all operations with it nop except add/sub - TODO)\n";
OS << " if (desc.attribute_size == 0) return vec4(1.);\n";
OS << "\n";
OS << " if (desc.attribute_size == 0)\n";
OS << " {\n";
OS << " //default values\n";
OS << " switch (location)\n";
OS << " {\n";
OS << " case 0:\n";
OS << " //position\n";
OS << " return vec4(0., 0., 0., 1.);\n";
OS << " case 1:\n";
OS << " case 2:\n";
OS << " //weight, normals\n";
OS << " return vec4(0.);\n";
OS << " case 3:\n";
OS << " //diffuse\n";
OS << " return vec4(1.);\n";
OS << " case 4:\n";
OS << " //specular\n";
OS << " return vec4(0.);\n";
OS << " case 5:\n";
OS << " //fog\n";
OS << " return vec4(0.);\n";
OS << " case 6:\n";
OS << " //point size\n";
OS << " return vec4(1.);\n";
OS << " default:\n";
OS << " //mostly just texture coordinates\n";
OS << " return vec4(0.);\n";
OS << " }\n";
OS << " }\n\n";
OS << " int vertex_id = " << vertex_id_name << " - int(vertex_base_index);\n";
OS << " if (desc.frequency == 0)\n";
OS << " vertex_id = 0;\n";