Commit 7ff576bb authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Select the blitter during adapter initialization.

parent 6806451d
...@@ -6948,7 +6948,7 @@ HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d, ...@@ -6948,7 +6948,7 @@ HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d,
return hr; return hr;
} }
device->blitter = select_blit_implementation(adapter, device_type); device->blitter = adapter->blitter;
return WINED3D_OK; return WINED3D_OK;
} }
......
...@@ -1655,6 +1655,17 @@ static const shader_backend_t *select_shader_backend(struct wined3d_adapter *ada ...@@ -1655,6 +1655,17 @@ static const shader_backend_t *select_shader_backend(struct wined3d_adapter *ada
return &none_shader_backend; return &none_shader_backend;
} }
static const struct blit_shader *select_blit_implementation(struct wined3d_adapter *adapter)
{
const struct wined3d_gl_info *gl_info = &adapter->gl_info;
int vs_selected_mode, ps_selected_mode;
select_shader_mode(gl_info, &ps_selected_mode, &vs_selected_mode);
if ((ps_selected_mode == SHADER_ARB || ps_selected_mode == SHADER_GLSL)
&& gl_info->supported[ARB_FRAGMENT_PROGRAM]) return &arbfp_blit;
else return &ffp_blit;
}
/* Context activation is done by the caller. */ /* Context activation is done by the caller. */
static BOOL IWineD3DImpl_FillGLCaps(struct wined3d_adapter *adapter) static BOOL IWineD3DImpl_FillGLCaps(struct wined3d_adapter *adapter)
{ {
...@@ -2095,6 +2106,7 @@ static BOOL IWineD3DImpl_FillGLCaps(struct wined3d_adapter *adapter) ...@@ -2095,6 +2106,7 @@ static BOOL IWineD3DImpl_FillGLCaps(struct wined3d_adapter *adapter)
adapter->fragment_pipe = select_fragment_implementation(adapter); adapter->fragment_pipe = select_fragment_implementation(adapter);
adapter->shader_backend = select_shader_backend(adapter); adapter->shader_backend = select_shader_backend(adapter);
adapter->blitter = select_blit_implementation(adapter);
/* In some cases the number of texture stages can be larger than the number /* In some cases the number of texture stages can be larger than the number
* of samplers. The GF4 for example can use only 2 samplers (no fragment * of samplers. The GF4 for example can use only 2 samplers (no fragment
...@@ -3231,8 +3243,6 @@ static BOOL CheckTextureCapability(struct wined3d_adapter *adapter, ...@@ -3231,8 +3243,6 @@ static BOOL CheckTextureCapability(struct wined3d_adapter *adapter,
static BOOL CheckSurfaceCapability(struct wined3d_adapter *adapter, const struct GlPixelFormatDesc *adapter_format_desc, static BOOL CheckSurfaceCapability(struct wined3d_adapter *adapter, const struct GlPixelFormatDesc *adapter_format_desc,
WINED3DDEVTYPE DeviceType, const struct GlPixelFormatDesc *check_format_desc, WINED3DSURFTYPE SurfaceType) WINED3DDEVTYPE DeviceType, const struct GlPixelFormatDesc *check_format_desc, WINED3DSURFTYPE SurfaceType)
{ {
const struct blit_shader *blitter;
if(SurfaceType == SURFACE_GDI) { if(SurfaceType == SURFACE_GDI) {
switch(check_format_desc->format) switch(check_format_desc->format)
{ {
...@@ -3268,8 +3278,7 @@ static BOOL CheckSurfaceCapability(struct wined3d_adapter *adapter, const struct ...@@ -3268,8 +3278,7 @@ static BOOL CheckSurfaceCapability(struct wined3d_adapter *adapter, const struct
if (CheckDepthStencilCapability(adapter, adapter_format_desc, check_format_desc)) return TRUE; if (CheckDepthStencilCapability(adapter, adapter_format_desc, check_format_desc)) return TRUE;
/* If opengl can't process the format natively, the blitter may be able to convert it */ /* If opengl can't process the format natively, the blitter may be able to convert it */
blitter = select_blit_implementation(adapter, DeviceType); if (adapter->blitter->color_fixup_supported(check_format_desc->color_fixup))
if (blitter->color_fixup_supported(check_format_desc->color_fixup))
{ {
TRACE_(d3d_caps)("[OK]\n"); TRACE_(d3d_caps)("[OK]\n");
return TRUE; return TRUE;
......
...@@ -2840,14 +2840,3 @@ void select_shader_mode(const struct wined3d_gl_info *gl_info, int *ps_selected, ...@@ -2840,14 +2840,3 @@ void select_shader_mode(const struct wined3d_gl_info *gl_info, int *ps_selected,
else if (gl_info->supported[ATI_FRAGMENT_SHADER]) *ps_selected = SHADER_ATI; else if (gl_info->supported[ATI_FRAGMENT_SHADER]) *ps_selected = SHADER_ATI;
else *ps_selected = SHADER_NONE; else *ps_selected = SHADER_NONE;
} }
const struct blit_shader *select_blit_implementation(struct wined3d_adapter *adapter, WINED3DDEVTYPE device_type)
{
const struct wined3d_gl_info *gl_info = &adapter->gl_info;
int vs_selected_mode, ps_selected_mode;
select_shader_mode(gl_info, &ps_selected_mode, &vs_selected_mode);
if ((ps_selected_mode == SHADER_ARB || ps_selected_mode == SHADER_GLSL)
&& gl_info->supported[ARB_FRAGMENT_PROGRAM]) return &arbfp_blit;
else return &ffp_blit;
}
...@@ -1365,6 +1365,7 @@ struct wined3d_adapter ...@@ -1365,6 +1365,7 @@ struct wined3d_adapter
const struct fragment_pipeline *fragment_pipe; const struct fragment_pipeline *fragment_pipe;
const shader_backend_t *shader_backend; const shader_backend_t *shader_backend;
const struct blit_shader *blitter;
}; };
BOOL initPixelFormats(struct wined3d_gl_info *gl_info, enum wined3d_pci_vendor vendor) DECLSPEC_HIDDEN; BOOL initPixelFormats(struct wined3d_gl_info *gl_info, enum wined3d_pci_vendor vendor) DECLSPEC_HIDDEN;
...@@ -2569,8 +2570,6 @@ void multiply_matrix(WINED3DMATRIX *dest, const WINED3DMATRIX *src1, const WINED ...@@ -2569,8 +2570,6 @@ void multiply_matrix(WINED3DMATRIX *dest, const WINED3DMATRIX *src1, const WINED
UINT wined3d_log2i(UINT32 x) DECLSPEC_HIDDEN; UINT wined3d_log2i(UINT32 x) DECLSPEC_HIDDEN;
unsigned int count_bits(unsigned int mask) DECLSPEC_HIDDEN; unsigned int count_bits(unsigned int mask) DECLSPEC_HIDDEN;
const struct blit_shader *select_blit_implementation(struct wined3d_adapter *adapter,
WINED3DDEVTYPE device_type) DECLSPEC_HIDDEN;
void select_shader_mode(const struct wined3d_gl_info *gl_info, int *ps_selected, int *vs_selected) DECLSPEC_HIDDEN; void select_shader_mode(const struct wined3d_gl_info *gl_info, int *ps_selected, int *vs_selected) DECLSPEC_HIDDEN;
typedef struct local_constant { typedef struct local_constant {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment