diff options
author | Subv <subv2112@gmail.com> | 2018-06-06 19:58:16 +0200 |
---|---|---|
committer | Subv <subv2112@gmail.com> | 2018-06-06 19:58:16 +0200 |
commit | dbfc39d21492dd1346b0e0d7ab5a2dbd989432bd (patch) | |
tree | fa95ce57c5f16a01b766efe2b49ed90888800e3d /src/video_core/renderer_opengl/gl_shader_gen.h | |
parent | nvdrv/devices/nvidia_ctrl_gpu : add IoctlCommands with their params (#524) (diff) | |
download | yuzu-dbfc39d21492dd1346b0e0d7ab5a2dbd989432bd.tar yuzu-dbfc39d21492dd1346b0e0d7ab5a2dbd989432bd.tar.gz yuzu-dbfc39d21492dd1346b0e0d7ab5a2dbd989432bd.tar.bz2 yuzu-dbfc39d21492dd1346b0e0d7ab5a2dbd989432bd.tar.lz yuzu-dbfc39d21492dd1346b0e0d7ab5a2dbd989432bd.tar.xz yuzu-dbfc39d21492dd1346b0e0d7ab5a2dbd989432bd.tar.zst yuzu-dbfc39d21492dd1346b0e0d7ab5a2dbd989432bd.zip |
Diffstat (limited to 'src/video_core/renderer_opengl/gl_shader_gen.h')
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_gen.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_gen.h b/src/video_core/renderer_opengl/gl_shader_gen.h index 458032b5c..e8b78934c 100644 --- a/src/video_core/renderer_opengl/gl_shader_gen.h +++ b/src/video_core/renderer_opengl/gl_shader_gen.h @@ -56,8 +56,48 @@ private: Maxwell::ShaderStage stage; }; +class SamplerEntry { + using Maxwell = Tegra::Engines::Maxwell3D::Regs; + +public: + SamplerEntry(Maxwell::ShaderStage stage, size_t offset, size_t index) + : offset(offset), stage(stage), sampler_index(index) {} + + size_t GetOffset() const { + return offset; + } + + size_t GetIndex() const { + return sampler_index; + } + + Maxwell::ShaderStage GetStage() const { + return stage; + } + + std::string GetName() const { + return std::string(TextureSamplerNames[static_cast<size_t>(stage)]) + '[' + + std::to_string(sampler_index) + ']'; + } + + static std::string GetArrayName(Maxwell::ShaderStage stage) { + return TextureSamplerNames[static_cast<size_t>(stage)]; + } + +private: + static constexpr std::array<const char*, Maxwell::MaxShaderStage> TextureSamplerNames = { + "tex_vs", "tex_tessc", "tex_tesse", "tex_gs", "tex_fs", + }; + /// Offset in TSC memory from which to read the sampler object, as specified by the sampling + /// instruction. + size_t offset; + Maxwell::ShaderStage stage; ///< Shader stage where this sampler was used. + size_t sampler_index; ///< Value used to index into the generated GLSL sampler array. +}; + struct ShaderEntries { std::vector<ConstBufferEntry> const_buffer_entries; + std::vector<SamplerEntry> texture_samplers; }; using ProgramResult = std::pair<std::string, ShaderEntries>; |