From: Zebediah Figura zfigura@codeweavers.com
--- dlls/wined3d/wined3d_gl.h | 102 ++++++++++++++++++++++++++++++++ dlls/wined3d/wined3d_private.h | 104 +-------------------------------- 2 files changed, 103 insertions(+), 103 deletions(-)
diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h index 6f0996fe39f..4654be41bec 100644 --- a/dlls/wined3d/wined3d_gl.h +++ b/dlls/wined3d/wined3d_gl.h @@ -32,6 +32,8 @@ #include "wine/wgl.h" #include "wine/wgl_driver.h"
+struct wined3d_texture_gl; + #define GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI 0x8837 /* not in the gl spec */
/* OpenGL extensions. */ @@ -890,4 +892,104 @@ void wined3d_device_gl_delete_opengl_contexts_cs(void *object); HDC wined3d_device_gl_get_backup_dc(struct wined3d_device_gl *device_gl); GLbitfield wined3d_device_gl_get_memory_type_flags(unsigned int memory_type_idx);
+GLbitfield wined3d_resource_gl_map_flags(const struct wined3d_bo_gl *bo, DWORD d3d_flags); +GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags); +GLbitfield wined3d_resource_gl_storage_flags(const struct wined3d_resource *resource); + +struct gl_texture +{ + struct wined3d_sampler_desc sampler_desc; + unsigned int base_level; + GLuint name; +}; + +struct wined3d_renderbuffer_entry +{ + struct list entry; + GLuint id; + unsigned int width, height; +}; + +struct wined3d_texture_gl +{ + struct wined3d_texture t; + + struct gl_texture texture_rgb, texture_srgb; + + GLenum target; + + GLuint rb_multisample; + GLuint rb_resolved; + + struct list renderbuffers; + const struct wined3d_renderbuffer_entry *current_renderbuffer; +}; + +static inline struct wined3d_texture_gl *wined3d_texture_gl(struct wined3d_texture *texture) +{ + return CONTAINING_RECORD(texture, struct wined3d_texture_gl, t); +} + +static inline struct gl_texture *wined3d_texture_gl_get_gl_texture(struct wined3d_texture_gl *texture_gl, bool srgb) +{ + return srgb ? &texture_gl->texture_srgb : &texture_gl->texture_rgb; +} + +static inline GLenum wined3d_texture_gl_get_sub_resource_target(const struct wined3d_texture_gl *texture_gl, + unsigned int sub_resource_idx) +{ + static const GLenum cube_targets[] = + { + GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, + GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, + GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, + GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, + GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB, + }; + + if (texture_gl->t.resource.usage & WINED3DUSAGE_LEGACY_CUBEMAP) + return cube_targets[sub_resource_idx / texture_gl->t.level_count]; + return texture_gl->target; +} + +static inline bool wined3d_texture_gl_is_multisample_location(const struct wined3d_texture_gl *texture_gl, + uint32_t location) +{ + if (location == WINED3D_LOCATION_RB_MULTISAMPLE) + return true; + if (location != WINED3D_LOCATION_TEXTURE_RGB && location != WINED3D_LOCATION_TEXTURE_SRGB) + return false; + return texture_gl->target == GL_TEXTURE_2D_MULTISAMPLE || texture_gl->target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY; +} + +struct wined3d_blt_info +{ + GLenum bind_target; + struct wined3d_vec3 texcoords[4]; +}; + +void texture2d_get_blt_info(const struct wined3d_texture_gl *texture_gl, unsigned int sub_resource_idx, + const RECT *rect, struct wined3d_blt_info *info); +void texture2d_load_fb_texture(struct wined3d_texture_gl *texture_gl, unsigned int sub_resource_idx, + BOOL srgb, struct wined3d_context *context); +void texture2d_read_from_framebuffer(struct wined3d_texture *texture, unsigned int sub_resource_idx, + struct wined3d_context *context, DWORD src_location, DWORD dst_location); + +void wined3d_gl_texture_swizzle_from_color_fixup(GLint swizzle[4], struct color_fixup_desc fixup); +GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture); + +void wined3d_texture_gl_apply_sampler_desc(struct wined3d_texture_gl *texture_gl, + const struct wined3d_sampler_desc *sampler_desc, const struct wined3d_context_gl *context_gl); +void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl, struct wined3d_context_gl *context_gl, BOOL srgb); +void wined3d_texture_gl_bind_and_dirtify(struct wined3d_texture_gl *texture_gl, + struct wined3d_context_gl *context_gl, BOOL srgb); +HRESULT wined3d_texture_gl_init(struct wined3d_texture_gl *texture_gl, struct wined3d_device *device, + const struct wined3d_resource_desc *desc, unsigned int layer_count, unsigned int level_count, + uint32_t flags, void *parent, const struct wined3d_parent_ops *parent_ops); +void wined3d_texture_gl_prepare_texture(struct wined3d_texture_gl *texture_gl, + struct wined3d_context_gl *context_gl, BOOL srgb); +void wined3d_texture_gl_set_compatible_renderbuffer(struct wined3d_texture_gl *texture_gl, + struct wined3d_context_gl *context_gl, unsigned int level, const struct wined3d_rendertarget_info *rt); + #endif /* __WINE_WINED3D_GL */ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index d9611f11ad7..f643de4561e 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -98,7 +98,6 @@ struct wined3d_context; struct wined3d_gl_info; struct wined3d_state; struct wined3d_swapchain_gl; -struct wined3d_texture_gl; struct wined3d_vertex_pipe_ops;
enum wined3d_ffp_idx @@ -3122,8 +3121,6 @@ void wined3d_allocator_cleanup(struct wined3d_allocator *allocator) DECLSPEC_HID bool wined3d_allocator_init(struct wined3d_allocator *allocator, size_t pool_count, const struct wined3d_allocator_ops *allocator_ops) DECLSPEC_HIDDEN;
-#include "wined3d_gl.h" - static inline float wined3d_alpha_ref(const struct wined3d_state *state) { return (state->render_states[WINED3D_RS_ALPHAREF] & 0xff) / 255.0f; @@ -3265,9 +3262,6 @@ void wined3d_resource_free_sysmem(struct wined3d_resource *resource) DECLSPEC_HI const struct wined3d_format *wined3d_resource_get_decompress_format( const struct wined3d_resource *resource) DECLSPEC_HIDDEN; unsigned int wined3d_resource_get_sample_count(const struct wined3d_resource *resource) DECLSPEC_HIDDEN; -GLbitfield wined3d_resource_gl_map_flags(const struct wined3d_bo_gl *bo, DWORD d3d_flags) DECLSPEC_HIDDEN; -GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN; -GLbitfield wined3d_resource_gl_storage_flags(const struct wined3d_resource *resource) DECLSPEC_HIDDEN; BOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource) DECLSPEC_HIDDEN; BOOL wined3d_resource_prepare_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN; void wined3d_resource_update_draw_binding(struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -3291,12 +3285,6 @@ void wined3d_resource_memory_colour_fill(struct wined3d_resource *resource,
const char *wined3d_debug_location(uint32_t location) DECLSPEC_HIDDEN;
-struct wined3d_blt_info -{ - GLenum bind_target; - struct wined3d_vec3 texcoords[4]; -}; - struct wined3d_texture_ops { BOOL (*texture_prepare_location)(struct wined3d_texture *texture, unsigned int sub_resource_idx, @@ -3490,19 +3478,12 @@ HRESULT texture2d_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_ const struct wined3d_box *dst_box, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, const struct wined3d_box *src_box, uint32_t flags, const struct wined3d_blt_fx *blt_fx, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN; -void texture2d_get_blt_info(const struct wined3d_texture_gl *texture_gl, unsigned int sub_resource_idx, - const RECT *rect, struct wined3d_blt_info *info) DECLSPEC_HIDDEN; -void texture2d_load_fb_texture(struct wined3d_texture_gl *texture_gl, unsigned int sub_resource_idx, - BOOL srgb, struct wined3d_context *context) DECLSPEC_HIDDEN; -void texture2d_read_from_framebuffer(struct wined3d_texture *texture, unsigned int sub_resource_idx, - struct wined3d_context *context, DWORD src_location, DWORD dst_location) DECLSPEC_HIDDEN;
void wined3d_texture_cleanup(struct wined3d_texture *texture) DECLSPEC_HIDDEN; void wined3d_texture_download_from_texture(struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx) DECLSPEC_HIDDEN; void wined3d_texture_get_bo_address(const struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_bo_address *data, uint32_t location) DECLSPEC_HIDDEN; -GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture) DECLSPEC_HIDDEN; void wined3d_texture_invalidate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, uint32_t location) DECLSPEC_HIDDEN; void wined3d_texture_load(struct wined3d_texture *texture, @@ -3534,90 +3515,7 @@ HRESULT wined3d_texture_no3d_init(struct wined3d_texture *texture_no3d, struct w const struct wined3d_resource_desc *desc, unsigned int layer_count, unsigned int level_count, uint32_t flags, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
-void wined3d_gl_texture_swizzle_from_color_fixup(GLint swizzle[4], struct color_fixup_desc fixup) DECLSPEC_HIDDEN; - -struct gl_texture -{ - struct wined3d_sampler_desc sampler_desc; - unsigned int base_level; - GLuint name; -}; - -struct wined3d_texture_gl -{ - struct wined3d_texture t; - - struct gl_texture texture_rgb, texture_srgb; - - GLenum target; - - GLuint rb_multisample; - GLuint rb_resolved; - - struct list renderbuffers; - const struct wined3d_renderbuffer_entry *current_renderbuffer; -}; - -static inline struct wined3d_texture_gl *wined3d_texture_gl(struct wined3d_texture *texture) -{ - return CONTAINING_RECORD(texture, struct wined3d_texture_gl, t); -} - -static inline struct gl_texture *wined3d_texture_gl_get_gl_texture(struct wined3d_texture_gl *texture_gl, - BOOL srgb) -{ - return srgb ? &texture_gl->texture_srgb : &texture_gl->texture_rgb; -} - -static inline GLenum wined3d_texture_gl_get_sub_resource_target(const struct wined3d_texture_gl *texture_gl, - unsigned int sub_resource_idx) -{ - static const GLenum cube_targets[] = - { - GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, - GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, - GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, - GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB, - }; - - return texture_gl->t.resource.usage & WINED3DUSAGE_LEGACY_CUBEMAP - ? cube_targets[sub_resource_idx / texture_gl->t.level_count] : texture_gl->target; -} - -static inline BOOL wined3d_texture_gl_is_multisample_location(const struct wined3d_texture_gl *texture_gl, - uint32_t location) -{ - if (location == WINED3D_LOCATION_RB_MULTISAMPLE) - return TRUE; - if (location != WINED3D_LOCATION_TEXTURE_RGB && location != WINED3D_LOCATION_TEXTURE_SRGB) - return FALSE; - return texture_gl->target == GL_TEXTURE_2D_MULTISAMPLE || texture_gl->target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY; -} - -void wined3d_texture_gl_apply_sampler_desc(struct wined3d_texture_gl *texture_gl, - const struct wined3d_sampler_desc *sampler_desc, const struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN; -void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl, - struct wined3d_context_gl *context_gl, BOOL srgb) DECLSPEC_HIDDEN; -void wined3d_texture_gl_bind_and_dirtify(struct wined3d_texture_gl *texture_gl, - struct wined3d_context_gl *context_gl, BOOL srgb) DECLSPEC_HIDDEN; -HRESULT wined3d_texture_gl_init(struct wined3d_texture_gl *texture_gl, struct wined3d_device *device, - const struct wined3d_resource_desc *desc, unsigned int layer_count, unsigned int level_count, - uint32_t flags, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; -void wined3d_texture_gl_prepare_texture(struct wined3d_texture_gl *texture_gl, - struct wined3d_context_gl *context_gl, BOOL srgb) DECLSPEC_HIDDEN; -void wined3d_texture_gl_set_compatible_renderbuffer(struct wined3d_texture_gl *texture_gl, - struct wined3d_context_gl *context_gl, unsigned int level, - const struct wined3d_rendertarget_info *rt) DECLSPEC_HIDDEN; - -struct wined3d_renderbuffer_entry -{ - struct list entry; - GLuint id; - UINT width; - UINT height; -}; +#include "wined3d_gl.h"
struct wined3d_fbo_resource {