diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 31 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/shader/shader_ir.h | 7 |
4 files changed, 34 insertions, 18 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index 74403eed4..079132135 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp | |||
| @@ -482,19 +482,8 @@ std::vector<Texture::FullTextureInfo> Maxwell3D::GetStageTextures(Regs::ShaderSt | |||
| 482 | return textures; | 482 | return textures; |
| 483 | } | 483 | } |
| 484 | 484 | ||
| 485 | Texture::FullTextureInfo Maxwell3D::GetStageTexture(Regs::ShaderStage stage, | 485 | Texture::FullTextureInfo Maxwell3D::GetTextureInfo(const Texture::TextureHandle tex_handle, |
| 486 | std::size_t offset) const { | 486 | std::size_t offset) const { |
| 487 | auto& shader = state.shader_stages[static_cast<std::size_t>(stage)]; | ||
| 488 | auto& tex_info_buffer = shader.const_buffers[regs.tex_cb_index]; | ||
| 489 | ASSERT(tex_info_buffer.enabled && tex_info_buffer.address != 0); | ||
| 490 | |||
| 491 | const GPUVAddr tex_info_address = | ||
| 492 | tex_info_buffer.address + offset * sizeof(Texture::TextureHandle); | ||
| 493 | |||
| 494 | ASSERT(tex_info_address < tex_info_buffer.address + tex_info_buffer.size); | ||
| 495 | |||
| 496 | const Texture::TextureHandle tex_handle{memory_manager.Read<u32>(tex_info_address)}; | ||
| 497 | |||
| 498 | Texture::FullTextureInfo tex_info{}; | 487 | Texture::FullTextureInfo tex_info{}; |
| 499 | tex_info.index = static_cast<u32>(offset); | 488 | tex_info.index = static_cast<u32>(offset); |
| 500 | 489 | ||
| @@ -511,6 +500,22 @@ Texture::FullTextureInfo Maxwell3D::GetStageTexture(Regs::ShaderStage stage, | |||
| 511 | return tex_info; | 500 | return tex_info; |
| 512 | } | 501 | } |
| 513 | 502 | ||
| 503 | Texture::FullTextureInfo Maxwell3D::GetStageTexture(Regs::ShaderStage stage, | ||
| 504 | std::size_t offset) const { | ||
| 505 | auto& shader = state.shader_stages[static_cast<std::size_t>(stage)]; | ||
| 506 | auto& tex_info_buffer = shader.const_buffers[regs.tex_cb_index]; | ||
| 507 | ASSERT(tex_info_buffer.enabled && tex_info_buffer.address != 0); | ||
| 508 | |||
| 509 | const GPUVAddr tex_info_address = | ||
| 510 | tex_info_buffer.address + offset * sizeof(Texture::TextureHandle); | ||
| 511 | |||
| 512 | ASSERT(tex_info_address < tex_info_buffer.address + tex_info_buffer.size); | ||
| 513 | |||
| 514 | const Texture::TextureHandle tex_handle{memory_manager.Read<u32>(tex_info_address)}; | ||
| 515 | |||
| 516 | return GetTextureInfo(tex_handle, offset); | ||
| 517 | } | ||
| 518 | |||
| 514 | u32 Maxwell3D::GetRegisterValue(u32 method) const { | 519 | u32 Maxwell3D::GetRegisterValue(u32 method) const { |
| 515 | ASSERT_MSG(method < Regs::NUM_REGS, "Invalid Maxwell3D register"); | 520 | ASSERT_MSG(method < Regs::NUM_REGS, "Invalid Maxwell3D register"); |
| 516 | return regs.reg_array[method]; | 521 | return regs.reg_array[method]; |
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 321af3297..fd2c35a01 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -1131,6 +1131,10 @@ public: | |||
| 1131 | /// Write the value to the register identified by method. | 1131 | /// Write the value to the register identified by method. |
| 1132 | void CallMethod(const GPU::MethodCall& method_call); | 1132 | void CallMethod(const GPU::MethodCall& method_call); |
| 1133 | 1133 | ||
| 1134 | /// Given a Texture Handle, returns the TSC and TIC entries. | ||
| 1135 | Texture::FullTextureInfo GetTextureInfo(const Texture::TextureHandle tex_handle, | ||
| 1136 | std::size_t offset) const; | ||
| 1137 | |||
| 1134 | /// Returns a list of enabled textures for the specified shader stage. | 1138 | /// Returns a list of enabled textures for the specified shader stage. |
| 1135 | std::vector<Texture::FullTextureInfo> GetStageTextures(Regs::ShaderStage stage) const; | 1139 | std::vector<Texture::FullTextureInfo> GetStageTextures(Regs::ShaderStage stage) const; |
| 1136 | 1140 | ||
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index f2ac5382d..a20acfe8e 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -985,7 +985,15 @@ void RasterizerOpenGL::SetupTextures(Maxwell::ShaderStage stage, const Shader& s | |||
| 985 | 985 | ||
| 986 | for (u32 bindpoint = 0; bindpoint < entries.size(); ++bindpoint) { | 986 | for (u32 bindpoint = 0; bindpoint < entries.size(); ++bindpoint) { |
| 987 | const auto& entry = entries[bindpoint]; | 987 | const auto& entry = entries[bindpoint]; |
| 988 | const auto texture = maxwell3d.GetStageTexture(stage, entry.GetOffset()); | 988 | Tegra::Texture::FullTextureInfo texture; |
| 989 | if (!entry.IsBindless()) { | ||
| 990 | texture = maxwell3d.GetStageTexture(stage, entry.GetOffset()); | ||
| 991 | } else { | ||
| 992 | const auto cbuf = entry.GetBindlessCBuf(); | ||
| 993 | Tegra::Texture::TextureHandle tex_handle; | ||
| 994 | tex_handle.raw = const_buffer_accessor.access32(stage, cbuf.first, cbuf.second); | ||
| 995 | texture = maxwell3d.GetTextureInfo(tex_handle, entry.GetOffset()); | ||
| 996 | } | ||
| 989 | const u32 current_bindpoint = base_bindings.sampler + bindpoint; | 997 | const u32 current_bindpoint = base_bindings.sampler + bindpoint; |
| 990 | 998 | ||
| 991 | texture_samplers[current_bindpoint].SyncWithConfig(texture.tsc); | 999 | texture_samplers[current_bindpoint].SyncWithConfig(texture.tsc); |
diff --git a/src/video_core/shader/shader_ir.h b/src/video_core/shader/shader_ir.h index 773c71fa5..ed321cfe5 100644 --- a/src/video_core/shader/shader_ir.h +++ b/src/video_core/shader/shader_ir.h | |||
| @@ -205,8 +205,8 @@ public: | |||
| 205 | // Use this constructor for bindless Samplers | 205 | // Use this constructor for bindless Samplers |
| 206 | explicit Sampler(u32 cbuf_index, u32 cbuf_offset, std::size_t index, | 206 | explicit Sampler(u32 cbuf_index, u32 cbuf_offset, std::size_t index, |
| 207 | Tegra::Shader::TextureType type, bool is_array, bool is_shadow) | 207 | Tegra::Shader::TextureType type, bool is_array, bool is_shadow) |
| 208 | : offset{(static_cast<u64>(cbuf_index) << 32) | cbuf_offset}, index{index}, type{type}, is_array{is_array}, | 208 | : offset{(static_cast<u64>(cbuf_index) << 32) | cbuf_offset}, index{index}, type{type}, |
| 209 | is_shadow{is_shadow}, is_bindless{true} {} | 209 | is_array{is_array}, is_shadow{is_shadow}, is_bindless{true} {} |
| 210 | 210 | ||
| 211 | // Use this only for serialization/deserialization | 211 | // Use this only for serialization/deserialization |
| 212 | explicit Sampler(std::size_t offset, std::size_t index, Tegra::Shader::TextureType type, | 212 | explicit Sampler(std::size_t offset, std::size_t index, Tegra::Shader::TextureType type, |
| @@ -214,7 +214,6 @@ public: | |||
| 214 | : offset{offset}, index{index}, type{type}, is_array{is_array}, is_shadow{is_shadow}, | 214 | : offset{offset}, index{index}, type{type}, is_array{is_array}, is_shadow{is_shadow}, |
| 215 | is_bindless{is_bindless} {} | 215 | is_bindless{is_bindless} {} |
| 216 | 216 | ||
| 217 | |||
| 218 | std::size_t GetOffset() const { | 217 | std::size_t GetOffset() const { |
| 219 | return offset; | 218 | return offset; |
| 220 | } | 219 | } |
| @@ -239,7 +238,7 @@ public: | |||
| 239 | return is_bindless; | 238 | return is_bindless; |
| 240 | } | 239 | } |
| 241 | 240 | ||
| 242 | std::pair<u32, u32> GetBindlessCBuf() { | 241 | std::pair<u32, u32> GetBindlessCBuf() const { |
| 243 | return {offset >> 32, offset & 0x00000000FFFFFFFFULL}; | 242 | return {offset >> 32, offset & 0x00000000FFFFFFFFULL}; |
| 244 | } | 243 | } |
| 245 | 244 | ||