GPUState: Encapsulate glPixelStorei inside the GLStateManager

Part of the Vulkan task T68990

Isolate the last remaining gl functions.
master
Clément Foucault 4 years ago
parent 77f60a0931
commit 28ea459a61

@ -128,7 +128,6 @@ void GPU_write_mask(eGPUWriteMask mask);
void GPU_color_mask(bool r, bool g, bool b, bool a);
void GPU_depth_mask(bool depth);
bool GPU_depth_mask_get(void);
void GPU_unpack_row_length_set(uint len);
void GPU_shadow_offset(bool enable);
void GPU_clip_distances(int distances_enabled);
bool GPU_mipmap_enabled(void);

@ -228,6 +228,7 @@ void GPU_texture_update_sub(GPUTexture *tex,
int width,
int height,
int depth);
void GPU_unpack_row_length_set(uint len);
void *GPU_texture_read(GPUTexture *tex, eGPUDataFormat data_format, int miplvl);
void GPU_texture_clear(GPUTexture *tex, eGPUDataFormat data_format, const void *data);

@ -303,11 +303,6 @@ void GPU_finish(void)
GPU_context_active_get()->finish();
}
void GPU_unpack_row_length_set(uint len)
{
glPixelStorei(GL_UNPACK_ROW_LENGTH, len);
}
/** \} */
/* -------------------------------------------------------------------- */

@ -166,6 +166,8 @@ class GPUStateManager {
virtual void texture_bind(Texture *tex, eGPUSamplerState sampler, int unit) = 0;
virtual void texture_unbind(Texture *tex) = 0;
virtual void texture_unbind_all(void) = 0;
virtual void texture_unpack_row_length_set(uint len) = 0;
};
} // namespace gpu

@ -380,6 +380,13 @@ void GPU_texture_update(GPUTexture *tex, eGPUDataFormat data_format, const void
reinterpret_cast<Texture *>(tex)->update(data_format, data);
}
/* Makes data interpretation aware of the source layout.
* Skipping pixels correctly when changing rows when doing partial update.*/
void GPU_unpack_row_length_set(uint len)
{
GPU_context_active_get()->state_manager->texture_unpack_row_length_set(len);
}
void GPU_invalid_tex_init(void)
{
/* TODO remove */

@ -520,6 +520,11 @@ void GLStateManager::texture_bind_apply(void)
}
}
void GLStateManager::texture_unpack_row_length_set(uint len)
{
glPixelStorei(GL_UNPACK_ROW_LENGTH, len);
}
uint64_t GLStateManager::bound_texture_slots(void)
{
uint64_t bound_slots = 0;

@ -74,6 +74,8 @@ class GLStateManager : public GPUStateManager {
void texture_unbind(Texture *tex) override;
void texture_unbind_all(void) override;
void texture_unpack_row_length_set(uint len) override;
uint64_t bound_texture_slots(void);
private:

Loading…
Cancel
Save