mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-11-03 16:39:01 -06:00 
			
		
		
		
	gl_state: Add support for glBindImageTextures
This commit is contained in:
		@@ -545,6 +545,26 @@ void OpenGLState::ApplySamplers() const {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void OpenGLState::ApplyImages() const {
 | 
			
		||||
    bool has_delta{};
 | 
			
		||||
    std::size_t first{};
 | 
			
		||||
    std::size_t last{};
 | 
			
		||||
    for (std::size_t i = 0; i < std::size(images); ++i) {
 | 
			
		||||
        if (!UpdateValue(cur_state.images[i], images[i])) {
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
        if (!has_delta) {
 | 
			
		||||
            first = i;
 | 
			
		||||
            has_delta = true;
 | 
			
		||||
        }
 | 
			
		||||
        last = i;
 | 
			
		||||
    }
 | 
			
		||||
    if (has_delta) {
 | 
			
		||||
        glBindImageTextures(static_cast<GLuint>(first), static_cast<GLsizei>(last - first + 1),
 | 
			
		||||
                            images.data() + first);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void OpenGLState::Apply() {
 | 
			
		||||
    MICROPROFILE_SCOPE(OpenGL_State);
 | 
			
		||||
    ApplyFramebufferState();
 | 
			
		||||
@@ -576,6 +596,7 @@ void OpenGLState::Apply() {
 | 
			
		||||
    ApplyLogicOp();
 | 
			
		||||
    ApplyTextures();
 | 
			
		||||
    ApplySamplers();
 | 
			
		||||
    ApplyImages();
 | 
			
		||||
    if (dirty.polygon_offset) {
 | 
			
		||||
        ApplyPolygonOffset();
 | 
			
		||||
        dirty.polygon_offset = false;
 | 
			
		||||
 
 | 
			
		||||
@@ -134,6 +134,8 @@ public:
 | 
			
		||||
    };
 | 
			
		||||
    std::array<TextureUnit, Tegra::Engines::Maxwell3D::Regs::NumTextureSamplers> texture_units;
 | 
			
		||||
 | 
			
		||||
    std::array<GLuint, Tegra::Engines::Maxwell3D::Regs::NumImages> images{};
 | 
			
		||||
 | 
			
		||||
    struct {
 | 
			
		||||
        GLuint read_framebuffer; // GL_READ_FRAMEBUFFER_BINDING
 | 
			
		||||
        GLuint draw_framebuffer; // GL_DRAW_FRAMEBUFFER_BINDING
 | 
			
		||||
@@ -220,6 +222,7 @@ public:
 | 
			
		||||
    void ApplyLogicOp() const;
 | 
			
		||||
    void ApplyTextures() const;
 | 
			
		||||
    void ApplySamplers() const;
 | 
			
		||||
    void ApplyImages() const;
 | 
			
		||||
    void ApplyDepthClamp() const;
 | 
			
		||||
    void ApplyPolygonOffset() const;
 | 
			
		||||
    void ApplyAlphaTest() const;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user