shaders: Add NumTextureSamplers const, remove unused #pragma.

merge-requests/60/head
bunnei 2018-04-14 18:50:06 +07:00
parent e6224fec27
commit 1b41b875dc
4 changed files with 5 additions and 4 deletions

@ -323,7 +323,5 @@ static_assert(sizeof(Instruction) == 0x8, "Incorrect structure size");
static_assert(std::is_standard_layout<Instruction>::value, static_assert(std::is_standard_layout<Instruction>::value,
"Structure does not have standard layout"); "Structure does not have standard layout");
#pragma pack()
} // namespace Shader } // namespace Shader
} // namespace Tegra } // namespace Tegra

@ -128,7 +128,7 @@ private:
OGLVertexArray hw_vao; OGLVertexArray hw_vao;
std::array<bool, 16> hw_vao_enabled_attributes; std::array<bool, 16> hw_vao_enabled_attributes;
std::array<SamplerInfo, 32> texture_samplers; std::array<SamplerInfo, GLShader::NumTextureSamplers> texture_samplers;
static constexpr size_t VERTEX_BUFFER_SIZE = 128 * 1024 * 1024; static constexpr size_t VERTEX_BUFFER_SIZE = 128 * 1024 * 1024;
std::unique_ptr<OGLStreamBuffer> vertex_buffer; std::unique_ptr<OGLStreamBuffer> vertex_buffer;
OGLBuffer uniform_buffer; OGLBuffer uniform_buffer;

@ -38,7 +38,7 @@ void SetShaderSamplerBindings(GLuint shader) {
cur_state.Apply(); cur_state.Apply();
// Set the texture samplers to correspond to different texture units // Set the texture samplers to correspond to different texture units
for (u32 texture = 0; texture < 32; ++texture) { for (u32 texture = 0; texture < NumTextureSamplers; ++texture) {
// Set the texture samplers to correspond to different texture units // Set the texture samplers to correspond to different texture units
std::string uniform_name = "tex[" + std::to_string(texture) + "]"; std::string uniform_name = "tex[" + std::to_string(texture) + "]";
GLint uniform_tex = glGetUniformLocation(shader, uniform_name.c_str()); GLint uniform_tex = glGetUniformLocation(shader, uniform_name.c_str());

@ -14,6 +14,9 @@
namespace GLShader { namespace GLShader {
/// Number of OpenGL texture samplers that can be used in the fragment shader
static constexpr size_t NumTextureSamplers = 32;
using Tegra::Engines::Maxwell3D; using Tegra::Engines::Maxwell3D;
namespace Impl { namespace Impl {