GPUTexture: Remove unused functions and avoid GPU_texture_opengl_bindcode
This is a cleanup.
This commit is contained in:
parent
a30ad3634d
commit
33b25b6a9e
|
@ -233,10 +233,6 @@ 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);
|
||||
|
||||
void GPU_invalid_tex_init(void);
|
||||
void GPU_invalid_tex_bind(int mode);
|
||||
void GPU_invalid_tex_free(void);
|
||||
|
||||
void GPU_texture_free(GPUTexture *tex);
|
||||
|
||||
void GPU_texture_ref(GPUTexture *tex);
|
||||
|
@ -262,7 +258,6 @@ int GPU_texture_orig_width(const GPUTexture *tex);
|
|||
int GPU_texture_orig_height(const GPUTexture *tex);
|
||||
void GPU_texture_orig_size_set(GPUTexture *tex, int w, int h);
|
||||
eGPUTextureFormat GPU_texture_format(const GPUTexture *tex);
|
||||
int GPU_texture_samples(const GPUTexture *tex);
|
||||
bool GPU_texture_array(const GPUTexture *tex);
|
||||
bool GPU_texture_cube(const GPUTexture *tex);
|
||||
bool GPU_texture_depth(const GPUTexture *tex);
|
||||
|
|
|
@ -455,11 +455,6 @@ void GPU_framebuffer_blit(GPUFrameBuffer *gpufb_read,
|
|||
BLI_assert(GPU_texture_stencil(read_tex) && GPU_texture_stencil(write_tex));
|
||||
BLI_assert(GPU_texture_format(read_tex) == GPU_texture_format(write_tex));
|
||||
}
|
||||
if (GPU_texture_samples(write_tex) != 0 || GPU_texture_samples(read_tex) != 0) {
|
||||
/* Can only blit multisample textures to another texture of the same size. */
|
||||
BLI_assert((GPU_texture_width(write_tex) == GPU_texture_width(read_tex)) &&
|
||||
(GPU_texture_height(write_tex) == GPU_texture_height(read_tex)));
|
||||
}
|
||||
#endif
|
||||
|
||||
fb_read->blit_to(blit_buffers, read_slot, fb_write, write_slot, 0, 0);
|
||||
|
|
|
@ -190,7 +190,7 @@ uint GPU_texture_memory_usage_get(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* ------ Texture Creation ------ */
|
||||
/* ------ Creation ------ */
|
||||
|
||||
static inline GPUTexture *gpu_texture_create(const char *name,
|
||||
const int w,
|
||||
|
@ -329,6 +329,8 @@ GPUTexture *GPU_texture_create_error(int dimension, bool is_array)
|
|||
return gpu_texture_create("invalid_tex", w, h, d, type, 1, GPU_RGBA8, pixel);
|
||||
}
|
||||
|
||||
/* ------ Update ------ */
|
||||
|
||||
void GPU_texture_update_mipmap(GPUTexture *tex_,
|
||||
int miplvl,
|
||||
eGPUDataFormat data_format,
|
||||
|
@ -387,20 +389,7 @@ 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 */
|
||||
}
|
||||
|
||||
void GPU_invalid_tex_bind(int UNUSED(mode))
|
||||
{
|
||||
/* TODO remove */
|
||||
}
|
||||
|
||||
void GPU_invalid_tex_free(void)
|
||||
{
|
||||
/* TODO remove */
|
||||
}
|
||||
/* ------ Binding ------ */
|
||||
|
||||
void GPU_texture_bind_ex(GPUTexture *tex_,
|
||||
eGPUSamplerState state,
|
||||
|
@ -547,12 +536,6 @@ eGPUTextureFormat GPU_texture_format(const GPUTexture *tex)
|
|||
return reinterpret_cast<const Texture *>(tex)->format_get();
|
||||
}
|
||||
|
||||
/* TODO remove */
|
||||
int GPU_texture_samples(const GPUTexture *UNUSED(tex))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool GPU_texture_depth(const GPUTexture *tex)
|
||||
{
|
||||
return (reinterpret_cast<const Texture *>(tex)->format_flag_get() & GPU_FORMAT_DEPTH) != 0;
|
||||
|
|
|
@ -241,6 +241,20 @@ class Texture {
|
|||
virtual bool init_internal(GPUVertBuf *vbo) = 0;
|
||||
};
|
||||
|
||||
/* Syntacting suggar. */
|
||||
static inline GPUTexture *wrap(Texture *vert)
|
||||
{
|
||||
return reinterpret_cast<GPUTexture *>(vert);
|
||||
}
|
||||
static inline Texture *unwrap(GPUTexture *vert)
|
||||
{
|
||||
return reinterpret_cast<Texture *>(vert);
|
||||
}
|
||||
static inline const Texture *unwrap(const GPUTexture *vert)
|
||||
{
|
||||
return reinterpret_cast<const Texture *>(vert);
|
||||
}
|
||||
|
||||
#undef DEBUG_NAME_LEN
|
||||
|
||||
inline size_t to_bytesize(eGPUTextureFormat format)
|
||||
|
|
|
@ -187,7 +187,7 @@ void GLFrameBuffer::update_attachments(void)
|
|||
glFramebufferTexture(GL_FRAMEBUFFER, gl_attachment, 0, 0);
|
||||
continue;
|
||||
}
|
||||
GLuint gl_tex = GPU_texture_opengl_bindcode(attach.tex);
|
||||
GLuint gl_tex = static_cast<GLTexture *>(unwrap(attach.tex))->tex_id_;
|
||||
if (attach.layer > -1 && GPU_texture_cube(attach.tex) && !GPU_texture_array(attach.tex)) {
|
||||
/* Could be avoided if ARB_direct_state_access is required. In this case
|
||||
* #glFramebufferTextureLayer would bind the correct face. */
|
||||
|
@ -216,7 +216,7 @@ void GLFrameBuffer::update_attachments(void)
|
|||
GPUAttachmentType type = GPU_FB_COLOR_ATTACHMENT0 + i;
|
||||
GPUAttachment &attach = attachments_[type];
|
||||
if (attach.tex != NULL) {
|
||||
gl_tex = GPU_texture_opengl_bindcode(attach.tex);
|
||||
gl_tex = static_cast<GLTexture *>(unwrap(attach.tex))->tex_id_;
|
||||
}
|
||||
else if (gl_tex != 0) {
|
||||
GLenum gl_attachment = to_gl(type);
|
||||
|
|
|
@ -46,6 +46,7 @@ namespace gpu {
|
|||
|
||||
class GLTexture : public Texture {
|
||||
friend class GLStateManager;
|
||||
friend class GLFrameBuffer;
|
||||
|
||||
private:
|
||||
/** All samplers states. */
|
||||
|
|
Loading…
Reference in New Issue