Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r--source/blender/gpu/intern/gpu_backend.hh6
-rw-r--r--source/blender/gpu/intern/gpu_batch.cc2
-rw-r--r--source/blender/gpu/intern/gpu_capabilities.cc4
-rw-r--r--source/blender/gpu/intern/gpu_context.cc40
-rw-r--r--source/blender/gpu/intern/gpu_context_private.hh51
-rw-r--r--source/blender/gpu/intern/gpu_framebuffer.cc22
-rw-r--r--source/blender/gpu/intern/gpu_immediate.cc2
-rw-r--r--source/blender/gpu/intern/gpu_matrix.cc16
-rw-r--r--source/blender/gpu/intern/gpu_shader.cc4
-rw-r--r--source/blender/gpu/intern/gpu_state.cc40
-rw-r--r--source/blender/gpu/intern/gpu_texture.cc10
11 files changed, 107 insertions, 90 deletions
diff --git a/source/blender/gpu/intern/gpu_backend.hh b/source/blender/gpu/intern/gpu_backend.hh
index 1a6a6668b42..04ec82a9213 100644
--- a/source/blender/gpu/intern/gpu_backend.hh
+++ b/source/blender/gpu/intern/gpu_backend.hh
@@ -25,11 +25,11 @@
#pragma once
-struct GPUContext;
-
namespace blender {
namespace gpu {
+class Context;
+
class Batch;
class DrawList;
class FrameBuffer;
@@ -48,7 +48,7 @@ class GPUBackend {
virtual void samplers_update(void) = 0;
- virtual GPUContext *context_alloc(void *ghost_window) = 0;
+ virtual Context *context_alloc(void *ghost_window) = 0;
virtual Batch *batch_alloc(void) = 0;
virtual DrawList *drawlist_alloc(int list_length) = 0;
diff --git a/source/blender/gpu/intern/gpu_batch.cc b/source/blender/gpu/intern/gpu_batch.cc
index d6f4f223a83..de079a89de7 100644
--- a/source/blender/gpu/intern/gpu_batch.cc
+++ b/source/blender/gpu/intern/gpu_batch.cc
@@ -258,7 +258,7 @@ void GPU_batch_draw_instanced(GPUBatch *batch, int i_count)
void GPU_batch_draw_advanced(
GPUBatch *gpu_batch, int v_first, int v_count, int i_first, int i_count)
{
- BLI_assert(GPU_context_active_get()->shader != NULL);
+ BLI_assert(Context::get()->shader != NULL);
Batch *batch = static_cast<Batch *>(gpu_batch);
if (v_count == 0) {
diff --git a/source/blender/gpu/intern/gpu_capabilities.cc b/source/blender/gpu/intern/gpu_capabilities.cc
index 0ee25ea2569..a79ce27ba63 100644
--- a/source/blender/gpu/intern/gpu_capabilities.cc
+++ b/source/blender/gpu/intern/gpu_capabilities.cc
@@ -115,13 +115,13 @@ bool GPU_mem_stats_supported(void)
void GPU_mem_stats_get(int *totalmem, int *freemem)
{
- GPU_context_active_get()->memory_statistics_get(totalmem, freemem);
+ Context::get()->memory_statistics_get(totalmem, freemem);
}
/* Return support for the active context + window. */
bool GPU_stereo_quadbuffer_support(void)
{
- return GPU_context_active_get()->front_right != nullptr;
+ return Context::get()->front_right != nullptr;
}
/** \} */
diff --git a/source/blender/gpu/intern/gpu_context.cc b/source/blender/gpu/intern/gpu_context.cc
index 8ebd49a658e..188225b3eed 100644
--- a/source/blender/gpu/intern/gpu_context.cc
+++ b/source/blender/gpu/intern/gpu_context.cc
@@ -54,20 +54,22 @@
using namespace blender::gpu;
-static thread_local GPUContext *active_ctx = NULL;
+static thread_local Context *active_ctx = NULL;
/* -------------------------------------------------------------------- */
-/** \name GPUContext methods
+/** \name gpu::Context methods
* \{ */
-GPUContext::GPUContext()
+namespace blender::gpu {
+
+Context::Context()
{
thread_ = pthread_self();
is_active_ = false;
matrix_state = GPU_matrix_state_create();
}
-GPUContext::~GPUContext()
+Context::~Context()
{
GPU_matrix_state_discard(matrix_state);
delete state_manager;
@@ -78,11 +80,18 @@ GPUContext::~GPUContext()
delete imm;
}
-bool GPUContext::is_active_on_thread(void)
+bool Context::is_active_on_thread(void)
{
return (this == active_ctx) && pthread_equal(pthread_self(), thread_);
}
+Context *Context::get(void)
+{
+ return active_ctx;
+}
+
+} // namespace blender::gpu
+
/** \} */
/* -------------------------------------------------------------------- */
@@ -94,22 +103,25 @@ GPUContext *GPU_context_create(void *ghost_window)
GPU_backend_init(GPU_BACKEND_OPENGL);
}
- GPUContext *ctx = GPUBackend::get()->context_alloc(ghost_window);
+ Context *ctx = GPUBackend::get()->context_alloc(ghost_window);
- GPU_context_active_set(ctx);
- return ctx;
+ GPU_context_active_set(wrap(ctx));
+ return wrap(ctx);
}
/* to be called after GPU_context_active_set(ctx_to_destroy) */
-void GPU_context_discard(GPUContext *ctx)
+void GPU_context_discard(GPUContext *ctx_)
{
+ Context *ctx = unwrap(ctx_);
delete ctx;
active_ctx = NULL;
}
/* ctx can be NULL */
-void GPU_context_active_set(GPUContext *ctx)
+void GPU_context_active_set(GPUContext *ctx_)
{
+ Context *ctx = unwrap(ctx_);
+
if (active_ctx) {
active_ctx->deactivate();
}
@@ -123,13 +135,7 @@ void GPU_context_active_set(GPUContext *ctx)
GPUContext *GPU_context_active_get(void)
{
- return active_ctx;
-}
-
-struct GPUMatrixState *gpu_context_active_matrix_state_get()
-{
- BLI_assert(active_ctx);
- return active_ctx->matrix_state;
+ return wrap(Context::get());
}
/* -------------------------------------------------------------------- */
diff --git a/source/blender/gpu/intern/gpu_context_private.hh b/source/blender/gpu/intern/gpu_context_private.hh
index 5344cc6fb87..bc07bea4bb1 100644
--- a/source/blender/gpu/intern/gpu_context_private.hh
+++ b/source/blender/gpu/intern/gpu_context_private.hh
@@ -34,22 +34,20 @@
#include "gpu_shader_private.hh"
#include "gpu_state_private.hh"
-#include <mutex>
#include <pthread.h>
-#include <string.h>
-#include <unordered_set>
-#include <vector>
struct GPUMatrixState;
-struct GPUContext {
+namespace blender::gpu {
+
+class Context {
public:
/** State management */
- blender::gpu::Shader *shader = NULL;
- blender::gpu::FrameBuffer *active_fb = NULL;
+ Shader *shader = NULL;
+ FrameBuffer *active_fb = NULL;
GPUMatrixState *matrix_state = NULL;
- blender::gpu::GPUStateManager *state_manager = NULL;
- blender::gpu::Immediate *imm = NULL;
+ GPUStateManager *state_manager = NULL;
+ Immediate *imm = NULL;
/**
* All 4 window frame-buffers.
@@ -58,10 +56,10 @@ struct GPUContext {
* Front frame-buffers contains (in principle, but not always) the last frame color.
* Default frame-buffer is back_left.
*/
- blender::gpu::FrameBuffer *back_left = NULL;
- blender::gpu::FrameBuffer *front_left = NULL;
- blender::gpu::FrameBuffer *back_right = NULL;
- blender::gpu::FrameBuffer *front_right = NULL;
+ FrameBuffer *back_left = NULL;
+ FrameBuffer *front_left = NULL;
+ FrameBuffer *back_right = NULL;
+ FrameBuffer *front_right = NULL;
protected:
/** Thread on which this context is active. */
@@ -71,8 +69,10 @@ struct GPUContext {
void *ghost_window_;
public:
- GPUContext();
- virtual ~GPUContext();
+ Context();
+ virtual ~Context();
+
+ static Context *get(void);
virtual void activate(void) = 0;
virtual void deactivate(void) = 0;
@@ -85,11 +85,20 @@ struct GPUContext {
virtual void memory_statistics_get(int *total_mem, int *free_mem) = 0;
bool is_active_on_thread(void);
-
- MEM_CXX_CLASS_ALLOC_FUNCS("GPUContext")
};
-void gpu_context_active_framebuffer_set(GPUContext *ctx, struct GPUFrameBuffer *fb);
-struct GPUFrameBuffer *gpu_context_active_framebuffer_get(GPUContext *ctx);
-
-struct GPUMatrixState *gpu_context_active_matrix_state_get(void);
+/* Syntacting suggar. */
+static inline GPUContext *wrap(Context *ctx)
+{
+ return reinterpret_cast<GPUContext *>(ctx);
+}
+static inline Context *unwrap(GPUContext *ctx)
+{
+ return reinterpret_cast<Context *>(ctx);
+}
+static inline const Context *unwrap(const GPUContext *ctx)
+{
+ return reinterpret_cast<const Context *>(ctx);
+}
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc
index e548eb241cf..88779dead28 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.cc
+++ b/source/blender/gpu/intern/gpu_framebuffer.cc
@@ -224,7 +224,7 @@ void GPU_framebuffer_bind_no_srgb(GPUFrameBuffer *gpu_fb)
*/
void GPU_backbuffer_bind(eGPUBackBuffer buffer)
{
- GPUContext *ctx = GPU_context_active_get();
+ Context *ctx = Context::get();
if (buffer == GPU_BACKBUFFER_LEFT) {
ctx->back_left->bind(false);
@@ -236,19 +236,19 @@ void GPU_backbuffer_bind(eGPUBackBuffer buffer)
void GPU_framebuffer_restore(void)
{
- GPU_context_active_get()->back_left->bind(false);
+ Context::get()->back_left->bind(false);
}
GPUFrameBuffer *GPU_framebuffer_active_get(void)
{
- GPUContext *ctx = GPU_context_active_get();
+ Context *ctx = Context::get();
return wrap(ctx ? ctx->active_fb : NULL);
}
/* Returns the default frame-buffer. Will always exists even if it's just a dummy. */
GPUFrameBuffer *GPU_framebuffer_back_get(void)
{
- GPUContext *ctx = GPU_context_active_get();
+ Context *ctx = Context::get();
return wrap(ctx ? ctx->back_left : NULL);
}
@@ -381,13 +381,13 @@ void GPU_framebuffer_multi_clear(GPUFrameBuffer *gpu_fb, const float (*clear_col
void GPU_clear_color(float red, float green, float blue, float alpha)
{
float clear_col[4] = {red, green, blue, alpha};
- GPU_context_active_get()->active_fb->clear(GPU_COLOR_BIT, clear_col, 0.0f, 0x0);
+ Context::get()->active_fb->clear(GPU_COLOR_BIT, clear_col, 0.0f, 0x0);
}
void GPU_clear_depth(float depth)
{
float clear_col[4] = {0};
- GPU_context_active_get()->active_fb->clear(GPU_DEPTH_BIT, clear_col, depth, 0x0);
+ Context::get()->active_fb->clear(GPU_DEPTH_BIT, clear_col, depth, 0x0);
}
void GPU_framebuffer_read_depth(
@@ -416,7 +416,7 @@ void GPU_frontbuffer_read_pixels(
int x, int y, int w, int h, int channels, eGPUDataFormat format, void *data)
{
int rect[4] = {x, y, w, h};
- GPU_context_active_get()->front_left->read(GPU_COLOR_BIT, format, rect, channels, 0, data);
+ Context::get()->front_left->read(GPU_COLOR_BIT, format, rect, channels, 0, data);
}
/* read_slot and write_slot are only used for color buffers. */
@@ -431,7 +431,7 @@ void GPU_framebuffer_blit(GPUFrameBuffer *gpufb_read,
FrameBuffer *fb_write = unwrap(gpufb_write);
BLI_assert(blit_buffers != 0);
- FrameBuffer *prev_fb = GPU_context_active_get()->active_fb;
+ FrameBuffer *prev_fb = Context::get()->active_fb;
#ifndef NDEBUG
GPUTexture *read_tex, *write_tex;
@@ -509,7 +509,7 @@ static GPUFrameBuffer *gpuPopFrameBuffer(void)
struct GPUOffScreen {
struct {
- GPUContext *ctx;
+ Context *ctx;
GPUFrameBuffer *fb;
} framebuffers[MAX_CTX_FB_LEN];
@@ -522,7 +522,7 @@ struct GPUOffScreen {
*/
static GPUFrameBuffer *gpu_offscreen_fb_get(GPUOffScreen *ofs)
{
- GPUContext *ctx = GPU_context_active_get();
+ Context *ctx = Context::get();
BLI_assert(ctx);
for (int i = 0; i < MAX_CTX_FB_LEN; i++) {
@@ -635,7 +635,7 @@ void GPU_offscreen_unbind(GPUOffScreen *UNUSED(ofs), bool restore)
void GPU_offscreen_draw_to_screen(GPUOffScreen *ofs, int x, int y)
{
- GPUContext *ctx = GPU_context_active_get();
+ Context *ctx = Context::get();
FrameBuffer *ofs_fb = unwrap(gpu_offscreen_fb_get(ofs));
ofs_fb->blit_to(GPU_COLOR_BIT, 0, ctx->active_fb, 0, x, y);
}
diff --git a/source/blender/gpu/intern/gpu_immediate.cc b/source/blender/gpu/intern/gpu_immediate.cc
index 9fc5e03a796..0a488c0dfc0 100644
--- a/source/blender/gpu/intern/gpu_immediate.cc
+++ b/source/blender/gpu/intern/gpu_immediate.cc
@@ -43,7 +43,7 @@ static thread_local Immediate *imm = NULL;
void immActivate(void)
{
- imm = GPU_context_active_get()->imm;
+ imm = Context::get()->imm;
}
void immDeactivate(void)
diff --git a/source/blender/gpu/intern/gpu_matrix.cc b/source/blender/gpu/intern/gpu_matrix.cc
index cdb6d303588..0274966d4b9 100644
--- a/source/blender/gpu/intern/gpu_matrix.cc
+++ b/source/blender/gpu/intern/gpu_matrix.cc
@@ -35,6 +35,8 @@
#include "MEM_guardedalloc.h"
+using namespace blender::gpu;
+
#define MATRIX_STACK_DEPTH 32
typedef float Mat4[4][4];
@@ -59,10 +61,10 @@ typedef struct GPUMatrixState {
*/
} GPUMatrixState;
-#define ModelViewStack gpu_context_active_matrix_state_get()->model_view_stack
+#define ModelViewStack Context::get()->matrix_state->model_view_stack
#define ModelView ModelViewStack.stack[ModelViewStack.top]
-#define ProjectionStack gpu_context_active_matrix_state_get()->projection_stack
+#define ProjectionStack Context::get()->matrix_state->projection_stack
#define Projection ProjectionStack.stack[ProjectionStack.top]
GPUMatrixState *GPU_matrix_state_create(void)
@@ -93,13 +95,13 @@ void GPU_matrix_state_discard(GPUMatrixState *state)
static void gpu_matrix_state_active_set_dirty(bool value)
{
- GPUMatrixState *state = gpu_context_active_matrix_state_get();
+ GPUMatrixState *state = Context::get()->matrix_state;
state->dirty = value;
}
void GPU_matrix_reset(void)
{
- GPUMatrixState *state = gpu_context_active_matrix_state_get();
+ GPUMatrixState *state = Context::get()->matrix_state;
state->model_view_stack.top = 0;
state->projection_stack.top = 0;
unit_m4(ModelView);
@@ -686,7 +688,7 @@ void GPU_matrix_bind(GPUShader *shader)
bool GPU_matrix_dirty_get(void)
{
- GPUMatrixState *state = gpu_context_active_matrix_state_get();
+ GPUMatrixState *state = Context::get()->matrix_state;
return state->dirty;
}
@@ -699,13 +701,13 @@ BLI_STATIC_ASSERT(GPU_PY_MATRIX_STACK_LEN + 1 == MATRIX_STACK_DEPTH, "define mis
int GPU_matrix_stack_level_get_model_view(void)
{
- GPUMatrixState *state = gpu_context_active_matrix_state_get();
+ GPUMatrixState *state = Context::get()->matrix_state;
return (int)state->model_view_stack.top;
}
int GPU_matrix_stack_level_get_projection(void)
{
- GPUMatrixState *state = gpu_context_active_matrix_state_get();
+ GPUMatrixState *state = Context::get()->matrix_state;
return (int)state->projection_stack.top;
}
diff --git a/source/blender/gpu/intern/gpu_shader.cc b/source/blender/gpu/intern/gpu_shader.cc
index eb0f7935b63..1bd076f96f8 100644
--- a/source/blender/gpu/intern/gpu_shader.cc
+++ b/source/blender/gpu/intern/gpu_shader.cc
@@ -457,7 +457,7 @@ void GPU_shader_bind(GPUShader *gpu_shader)
{
Shader *shader = unwrap(gpu_shader);
- GPUContext *ctx = GPU_context_active_get();
+ Context *ctx = Context::get();
if (ctx->shader != shader) {
ctx->shader = shader;
@@ -474,7 +474,7 @@ void GPU_shader_bind(GPUShader *gpu_shader)
void GPU_shader_unbind(void)
{
#ifndef NDEBUG
- GPUContext *ctx = GPU_context_active_get();
+ Context *ctx = Context::get();
if (ctx->shader) {
ctx->shader->unbind();
}
diff --git a/source/blender/gpu/intern/gpu_state.cc b/source/blender/gpu/intern/gpu_state.cc
index 68f0c290bc6..529c8795327 100644
--- a/source/blender/gpu/intern/gpu_state.cc
+++ b/source/blender/gpu/intern/gpu_state.cc
@@ -41,7 +41,7 @@ using namespace blender::gpu;
#define SET_STATE(_prefix, _state, _value) \
do { \
- GPUStateManager *stack = GPU_context_active_get()->state_manager; \
+ GPUStateManager *stack = Context::get()->state_manager; \
auto &state_object = stack->_prefix##state; \
state_object._state = (_value); \
} while (0)
@@ -105,7 +105,7 @@ void GPU_write_mask(eGPUWriteMask mask)
void GPU_color_mask(bool r, bool g, bool b, bool a)
{
- GPUStateManager *stack = GPU_context_active_get()->state_manager;
+ GPUStateManager *stack = Context::get()->state_manager;
auto &state = stack->state;
uint32_t write_mask = state.write_mask;
SET_FLAG_FROM_TEST(write_mask, r, (uint32_t)GPU_WRITE_RED);
@@ -117,7 +117,7 @@ void GPU_color_mask(bool r, bool g, bool b, bool a)
void GPU_depth_mask(bool depth)
{
- GPUStateManager *stack = GPU_context_active_get()->state_manager;
+ GPUStateManager *stack = Context::get()->state_manager;
auto &state = stack->state;
uint32_t write_mask = state.write_mask;
SET_FLAG_FROM_TEST(write_mask, depth, (uint32_t)GPU_WRITE_DEPTH);
@@ -142,7 +142,7 @@ void GPU_state_set(eGPUWriteMask write_mask,
eGPUStencilOp stencil_op,
eGPUProvokingVertex provoking_vert)
{
- GPUStateManager *stack = GPU_context_active_get()->state_manager;
+ GPUStateManager *stack = Context::get()->state_manager;
auto &state = stack->state;
state.write_mask = (uint32_t)write_mask;
state.blend = (uint32_t)blend;
@@ -161,7 +161,7 @@ void GPU_state_set(eGPUWriteMask write_mask,
void GPU_depth_range(float near, float far)
{
- GPUStateManager *stack = GPU_context_active_get()->state_manager;
+ GPUStateManager *stack = Context::get()->state_manager;
auto &state = stack->mutable_state;
copy_v2_fl2(state.depth_range, near, far);
}
@@ -182,7 +182,7 @@ void GPU_point_size(float size)
/* TODO remove and use program point size everywhere */
void GPU_program_point_size(bool enable)
{
- GPUStateManager *stack = GPU_context_active_get()->state_manager;
+ GPUStateManager *stack = Context::get()->state_manager;
auto &state = stack->mutable_state;
/* Set point size sign negative to disable. */
state.point_size = fabsf(state.point_size) * (enable ? 1 : -1);
@@ -190,19 +190,19 @@ void GPU_program_point_size(bool enable)
void GPU_scissor_test(bool enable)
{
- GPU_context_active_get()->active_fb->scissor_test_set(enable);
+ Context::get()->active_fb->scissor_test_set(enable);
}
void GPU_scissor(int x, int y, int width, int height)
{
int scissor_rect[4] = {x, y, width, height};
- GPU_context_active_get()->active_fb->scissor_set(scissor_rect);
+ Context::get()->active_fb->scissor_set(scissor_rect);
}
void GPU_viewport(int x, int y, int width, int height)
{
int viewport_rect[4] = {x, y, width, height};
- GPU_context_active_get()->active_fb->viewport_set(viewport_rect);
+ Context::get()->active_fb->viewport_set(viewport_rect);
}
void GPU_stencil_reference_set(uint reference)
@@ -228,43 +228,43 @@ void GPU_stencil_compare_mask_set(uint compare_mask)
eGPUBlend GPU_blend_get()
{
- GPUState &state = GPU_context_active_get()->state_manager->state;
+ GPUState &state = Context::get()->state_manager->state;
return (eGPUBlend)state.blend;
}
eGPUWriteMask GPU_write_mask_get()
{
- GPUState &state = GPU_context_active_get()->state_manager->state;
+ GPUState &state = Context::get()->state_manager->state;
return (eGPUWriteMask)state.write_mask;
}
uint GPU_stencil_mask_get()
{
- GPUStateMutable &state = GPU_context_active_get()->state_manager->mutable_state;
+ GPUStateMutable &state = Context::get()->state_manager->mutable_state;
return state.stencil_write_mask;
}
eGPUDepthTest GPU_depth_test_get()
{
- GPUState &state = GPU_context_active_get()->state_manager->state;
+ GPUState &state = Context::get()->state_manager->state;
return (eGPUDepthTest)state.depth_test;
}
eGPUStencilTest GPU_stencil_test_get()
{
- GPUState &state = GPU_context_active_get()->state_manager->state;
+ GPUState &state = Context::get()->state_manager->state;
return (eGPUStencilTest)state.stencil_test;
}
void GPU_scissor_get(int coords[4])
{
- GPU_context_active_get()->active_fb->scissor_get(coords);
+ Context::get()->active_fb->scissor_get(coords);
}
void GPU_viewport_size_get_f(float coords[4])
{
int viewport[4];
- GPU_context_active_get()->active_fb->viewport_get(viewport);
+ Context::get()->active_fb->viewport_get(viewport);
for (int i = 0; i < 4; i++) {
coords[i] = viewport[i];
}
@@ -272,12 +272,12 @@ void GPU_viewport_size_get_f(float coords[4])
void GPU_viewport_size_get_i(int coords[4])
{
- GPU_context_active_get()->active_fb->viewport_get(coords);
+ Context::get()->active_fb->viewport_get(coords);
}
bool GPU_depth_mask_get(void)
{
- GPUState &state = GPU_context_active_get()->state_manager->state;
+ GPUState &state = Context::get()->state_manager->state;
return (state.write_mask & GPU_WRITE_DEPTH) != 0;
}
@@ -295,12 +295,12 @@ bool GPU_mipmap_enabled(void)
void GPU_flush(void)
{
- GPU_context_active_get()->flush();
+ Context::get()->flush();
}
void GPU_finish(void)
{
- GPU_context_active_get()->finish();
+ Context::get()->finish();
}
/** \} */
diff --git a/source/blender/gpu/intern/gpu_texture.cc b/source/blender/gpu/intern/gpu_texture.cc
index 05b97129f00..b22fd53f0f6 100644
--- a/source/blender/gpu/intern/gpu_texture.cc
+++ b/source/blender/gpu/intern/gpu_texture.cc
@@ -386,7 +386,7 @@ void GPU_texture_update(GPUTexture *tex, eGPUDataFormat data_format, const void
* 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);
+ Context::get()->state_manager->texture_unpack_row_length_set(len);
}
/* ------ Binding ------ */
@@ -398,24 +398,24 @@ void GPU_texture_bind_ex(GPUTexture *tex_,
{
Texture *tex = reinterpret_cast<Texture *>(tex_);
state = (state >= GPU_SAMPLER_MAX) ? tex->sampler_state : state;
- GPU_context_active_get()->state_manager->texture_bind(tex, state, unit);
+ Context::get()->state_manager->texture_bind(tex, state, unit);
}
void GPU_texture_bind(GPUTexture *tex_, int unit)
{
Texture *tex = reinterpret_cast<Texture *>(tex_);
- GPU_context_active_get()->state_manager->texture_bind(tex, tex->sampler_state, unit);
+ Context::get()->state_manager->texture_bind(tex, tex->sampler_state, unit);
}
void GPU_texture_unbind(GPUTexture *tex_)
{
Texture *tex = reinterpret_cast<Texture *>(tex_);
- GPU_context_active_get()->state_manager->texture_unbind(tex);
+ Context::get()->state_manager->texture_unbind(tex);
}
void GPU_texture_unbind_all(void)
{
- GPU_context_active_get()->state_manager->texture_unbind_all();
+ Context::get()->state_manager->texture_unbind_all();
}
void GPU_texture_generate_mipmap(GPUTexture *tex)