Skip to content

Commit

Permalink
nv2a/gl: Unify ShaderBinding and ShaderLruNode
Browse files Browse the repository at this point in the history
  • Loading branch information
mborgerson committed Jan 8, 2025
1 parent e7047ef commit 510c280
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 115 deletions.
27 changes: 13 additions & 14 deletions hw/xbox/nv2a/pgraph/gl/renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ typedef struct TextureBinding {
} TextureBinding;

typedef struct ShaderBinding {
LruNode node;
bool initialized;

bool cached;
void *program;
size_t program_size;
GLenum program_format;
ShaderState state;
QemuThread *save_thread;

GLuint gl_program;
GLenum gl_primitive_mode;

Expand Down Expand Up @@ -117,17 +127,6 @@ typedef struct ShaderBinding {
GLint material_alpha_loc;
} ShaderBinding;

typedef struct ShaderLruNode {
LruNode node;
bool cached;
void *program;
size_t program_size;
GLenum program_format;
ShaderState state;
ShaderBinding *binding;
QemuThread *save_thread;
} ShaderLruNode;

typedef struct VertexKey {
size_t count;
size_t stride;
Expand Down Expand Up @@ -196,7 +195,7 @@ typedef struct PGRAPHGLState {
TextureLruNode *texture_cache_entries;

Lru shader_cache;
ShaderLruNode *shader_cache_entries;
ShaderBinding *shader_cache_entries;
ShaderBinding *shader_binding;
QemuMutex shader_cache_lock;
QemuThread shader_disk_thread;
Expand Down Expand Up @@ -279,8 +278,8 @@ SurfaceBinding *pgraph_gl_surface_get_within(NV2AState *d, hwaddr addr);
void pgraph_gl_surface_invalidate(NV2AState *d, SurfaceBinding *e);
void pgraph_gl_unbind_surface(NV2AState *d, bool color);
void pgraph_gl_upload_surface_data(NV2AState *d, SurfaceBinding *surface, bool force);
void pgraph_gl_shader_cache_to_disk(ShaderLruNode *snode);
bool pgraph_gl_shader_load_from_memory(ShaderLruNode *snode);
void pgraph_gl_shader_cache_to_disk(ShaderBinding *snode);
bool pgraph_gl_shader_load_from_memory(ShaderBinding *snode);
void pgraph_gl_shader_write_cache_reload_list(PGRAPHState *pg);
void pgraph_gl_set_surface_scale_factor(NV2AState *d, unsigned int scale);
unsigned int pgraph_gl_get_surface_scale_factor(NV2AState *d);
Expand Down
Loading

0 comments on commit 510c280

Please sign in to comment.