Commit f82a437a authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Create wined3d sampler for NULL sampler.

parent a7dadf2f
...@@ -3433,7 +3433,7 @@ static void context_bind_shader_resources(struct wined3d_context *context, ...@@ -3433,7 +3433,7 @@ static void context_bind_shader_resources(struct wined3d_context *context,
else if ((sampler = state->sampler[shader_type][entry->sampler_idx])) else if ((sampler = state->sampler[shader_type][entry->sampler_idx]))
sampler_name = sampler->name; sampler_name = sampler->name;
else else
sampler_name = device->null_sampler; sampler_name = device->null_sampler->name;
context_active_texture(context, gl_info, bind_idx); context_active_texture(context, gl_info, bind_idx);
GL_EXTCALL(glBindSampler(bind_idx, sampler_name)); GL_EXTCALL(glBindSampler(bind_idx, sampler_name));
......
...@@ -775,7 +775,6 @@ static void destroy_dummy_textures(struct wined3d_device *device, struct wined3d ...@@ -775,7 +775,6 @@ static void destroy_dummy_textures(struct wined3d_device *device, struct wined3d
/* Context activation is done by the caller. */ /* Context activation is done by the caller. */
static void create_default_samplers(struct wined3d_device *device, struct wined3d_context *context) static void create_default_samplers(struct wined3d_device *device, struct wined3d_context *context)
{ {
const struct wined3d_gl_info *gl_info = context->gl_info;
struct wined3d_sampler_desc desc; struct wined3d_sampler_desc desc;
HRESULT hr; HRESULT hr;
...@@ -806,37 +805,27 @@ static void create_default_samplers(struct wined3d_device *device, struct wined3 ...@@ -806,37 +805,27 @@ static void create_default_samplers(struct wined3d_device *device, struct wined3
device->default_sampler = NULL; device->default_sampler = NULL;
} }
if (gl_info->supported[ARB_SAMPLER_OBJECTS])
{
/* In D3D10+, a NULL sampler maps to the default sampler state. */ /* In D3D10+, a NULL sampler maps to the default sampler state. */
GL_EXTCALL(glGenSamplers(1, &device->null_sampler)); desc.address_u = WINED3D_TADDRESS_CLAMP;
GL_EXTCALL(glSamplerParameteri(device->null_sampler, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR)); desc.address_v = WINED3D_TADDRESS_CLAMP;
GL_EXTCALL(glSamplerParameteri(device->null_sampler, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)); desc.address_w = WINED3D_TADDRESS_CLAMP;
GL_EXTCALL(glSamplerParameteri(device->null_sampler, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)); desc.mag_filter = WINED3D_TEXF_LINEAR;
GL_EXTCALL(glSamplerParameteri(device->null_sampler, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE)); desc.min_filter = WINED3D_TEXF_LINEAR;
checkGLcall("Create null sampler"); desc.mip_filter = WINED3D_TEXF_LINEAR;
} if (FAILED(hr = wined3d_sampler_create(device, &desc, NULL, &device->null_sampler)))
else
{ {
device->null_sampler = 0; ERR("Failed to create null sampler, hr %#x.n", hr);
device->null_sampler = NULL;
} }
} }
/* Context activation is done by the caller. */ /* Context activation is done by the caller. */
static void destroy_default_samplers(struct wined3d_device *device, struct wined3d_context *context) static void destroy_default_samplers(struct wined3d_device *device, struct wined3d_context *context)
{ {
const struct wined3d_gl_info *gl_info = context->gl_info;
wined3d_sampler_decref(device->default_sampler); wined3d_sampler_decref(device->default_sampler);
device->default_sampler = NULL; device->default_sampler = NULL;
wined3d_sampler_decref(device->null_sampler);
if (gl_info->supported[ARB_SAMPLER_OBJECTS]) device->null_sampler = NULL;
{
GL_EXTCALL(glDeleteSamplers(1, &device->null_sampler));
checkGLcall("glDeleteSamplers");
}
device->null_sampler = 0;
} }
static LONG fullscreen_style(LONG style) static LONG fullscreen_style(LONG style)
......
...@@ -2689,7 +2689,7 @@ struct wined3d_device ...@@ -2689,7 +2689,7 @@ struct wined3d_device
/* Default sampler used to emulate the direct resource access without using wined3d_sampler */ /* Default sampler used to emulate the direct resource access without using wined3d_sampler */
struct wined3d_sampler *default_sampler; struct wined3d_sampler *default_sampler;
GLuint null_sampler; struct wined3d_sampler *null_sampler;
/* Command stream */ /* Command stream */
struct wined3d_cs *cs; struct wined3d_cs *cs;
......
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