summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-05-30 20:10:48 +0200
committerGitHub <noreply@github.com>2018-05-30 20:10:48 +0200
commit15086a22be5f8b63c2ab62b17da6201a72af5daa (patch)
treeaa5712fc1c25ee747b7d1e3b999b2302b2a2ed78 /src/video_core
parentadd IPC CommandType & Some HID FunctionInfo (#487) (diff)
parentShaders: Implemented reading the gl_InstanceID and gl_VertexID variables in the vertex shader. (diff)
downloadyuzu-15086a22be5f8b63c2ab62b17da6201a72af5daa.tar
yuzu-15086a22be5f8b63c2ab62b17da6201a72af5daa.tar.gz
yuzu-15086a22be5f8b63c2ab62b17da6201a72af5daa.tar.bz2
yuzu-15086a22be5f8b63c2ab62b17da6201a72af5daa.tar.lz
yuzu-15086a22be5f8b63c2ab62b17da6201a72af5daa.tar.xz
yuzu-15086a22be5f8b63c2ab62b17da6201a72af5daa.tar.zst
yuzu-15086a22be5f8b63c2ab62b17da6201a72af5daa.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/engines/shader_bytecode.h4
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp8
2 files changed, 11 insertions, 1 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h
index 198a470c0..f32a17057 100644
--- a/src/video_core/engines/shader_bytecode.h
+++ b/src/video_core/engines/shader_bytecode.h
@@ -75,6 +75,10 @@ union Attribute {
enum class Index : u64 {
Position = 7,
Attribute_0 = 8,
+ // This attribute contains a tuple of (~, ~, InstanceId, VertexId) when inside a vertex
+ // shader, and a tuple of (TessCoord.x, TessCoord.y, TessCoord.z, ~) when inside a Tess Eval
+ // shader.
+ TessCoordInstanceIDVertexID = 47,
};
union {
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index 70ddea643..68efe74b8 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -299,7 +299,7 @@ public:
* are stored as floats, so this may require conversion.
* @param reg The destination register to use.
* @param elem The element to use for the operation.
- * @param attribute The input attibute to use as the source value.
+ * @param attribute The input attribute to use as the source value.
*/
void SetRegisterToInputAttibute(const Register& reg, u64 elem, Attribute::Index attribute) {
std::string dest = GetRegisterAsFloat(reg);
@@ -451,6 +451,12 @@ private:
switch (attribute) {
case Attribute::Index::Position:
return "position";
+ case Attribute::Index::TessCoordInstanceIDVertexID:
+ // TODO(Subv): Find out what the values are for the first two elements when inside a
+ // vertex shader, and what's the value of the fourth element when inside a Tess Eval
+ // shader.
+ ASSERT(stage == Maxwell3D::Regs::ShaderStage::Vertex);
+ return "vec4(0, 0, gl_InstanceID, gl_VertexID)";
default:
const u32 index{static_cast<u32>(attribute) -
static_cast<u32>(Attribute::Index::Attribute_0)};