From: Connor McAdams conmanx360@gmail.com
Signed-off-by: Connor McAdams conmanx360@gmail.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v2: Clean it up a bit.
dlls/d3d10/d3d10_private.h | 10 ++++++ dlls/d3d10/effect.c | 62 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+)
diff --git a/dlls/d3d10/d3d10_private.h b/dlls/d3d10/d3d10_private.h index 96020cd4a0c..f83ff0d4c94 100644 --- a/dlls/d3d10/d3d10_private.h +++ b/dlls/d3d10/d3d10_private.h @@ -114,6 +114,15 @@ struct d3d10_effect_state_object_variable } object; };
+struct d3d10_effect_buffer_variable +{ + ID3D10Buffer *buffer; + ID3D10ShaderResourceView *resource_view; + + BOOL changed; + BYTE *local_buffer; +}; + /* ID3D10EffectType */ struct d3d10_effect_type { @@ -169,6 +178,7 @@ struct d3d10_effect_variable { struct d3d10_effect_state_object_variable state; struct d3d10_effect_shader_variable shader; + struct d3d10_effect_buffer_variable buffer; } u; };
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 91e713bdf54..3ee9bf7a35c 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -2096,6 +2096,55 @@ static HRESULT parse_fx10_local_variable(const char *data, size_t data_size, return S_OK; }
+static HRESULT create_variable_buffer(struct d3d10_effect_variable *v, D3D10_CBUFFER_TYPE type) +{ + D3D10_BUFFER_DESC buffer_desc; + D3D10_SUBRESOURCE_DATA subresource_data; + D3D10_SHADER_RESOURCE_VIEW_DESC srv_desc; + ID3D10Device *device = v->effect->device; + HRESULT hr; + + if (!(v->u.buffer.local_buffer = heap_alloc_zero(v->type->size_unpacked))) + { + ERR("Failed to allocate local constant buffer memory.\n"); + return E_OUTOFMEMORY; + } + + buffer_desc.ByteWidth = v->type->size_unpacked; + buffer_desc.Usage = D3D10_USAGE_DEFAULT; + buffer_desc.CPUAccessFlags = 0; + buffer_desc.MiscFlags = 0; + if (type == D3D10_CT_CBUFFER) + buffer_desc.BindFlags = D3D10_BIND_CONSTANT_BUFFER; + else + buffer_desc.BindFlags = D3D10_BIND_SHADER_RESOURCE; + + subresource_data.pSysMem = v->u.buffer.local_buffer; + subresource_data.SysMemPitch = 0; + subresource_data.SysMemSlicePitch = 0; + + if (FAILED(hr = ID3D10Device_CreateBuffer(device, &buffer_desc, &subresource_data, &v->u.buffer.buffer))) + return hr; + + if (type == D3D10_CT_TBUFFER) + { + srv_desc.Format = DXGI_FORMAT_R32G32B32A32_UINT; + srv_desc.ViewDimension = D3D_SRV_DIMENSION_BUFFER; + srv_desc.Buffer.ElementOffset = 0; + srv_desc.Buffer.ElementWidth = v->type->size_unpacked / 16; + if (v->type->size_unpacked % 16) + WARN("Unexpected texture buffer size not a multiple of 16.\n"); + + if (FAILED(hr = ID3D10Device_CreateShaderResourceView(device, (ID3D10Resource *)v->u.buffer.buffer, + &srv_desc, &v->u.buffer.resource_view))) + return hr; + } + else + v->u.buffer.resource_view = NULL; + + return S_OK; +} + static HRESULT parse_fx10_local_buffer(const char *data, size_t data_size, const char **ptr, struct d3d10_effect_variable *l) { @@ -2282,6 +2331,12 @@ static HRESULT parse_fx10_local_buffer(const char *data, size_t data_size, TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(l->type->basetype)); TRACE("\tTypeclass: %s.\n", debug_d3d10_shader_variable_class(l->type->type_class));
+ if (l->type->size_unpacked) + { + if (FAILED(hr = create_variable_buffer(l, d3d10_cbuffer_type))) + return hr; + } + return S_OK; }
@@ -2760,6 +2815,13 @@ static void d3d10_effect_local_buffer_destroy(struct d3d10_effect_variable *l) } heap_free(l->annotations); } + + heap_free(l->u.buffer.local_buffer); + + if (l->u.buffer.buffer) + ID3D10Buffer_Release(l->u.buffer.buffer); + if (l->u.buffer.resource_view) + ID3D10ShaderResourceView_Release(l->u.buffer.resource_view); }
/* IUnknown methods */
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dcompiler_43/d3dcompiler_private.h | 3 --- 1 file changed, 3 deletions(-)
diff --git a/dlls/d3dcompiler_43/d3dcompiler_private.h b/dlls/d3dcompiler_43/d3dcompiler_private.h index 3146f57c59d..22cc41db56a 100644 --- a/dlls/d3dcompiler_43/d3dcompiler_private.h +++ b/dlls/d3dcompiler_43/d3dcompiler_private.h @@ -539,9 +539,6 @@ enum bwritershader_param_srcmod_type #define BWRITERPS_VERSION(major, minor) ((BWRITER_SM1_PS << 16) | ((major) << 8) | (minor)) #define BWRITERVS_VERSION(major, minor) ((BWRITER_SM1_VS << 16) | ((major) << 8) | (minor))
-#define BWRITERVS_SWIZZLE_SHIFT 16 -#define BWRITERVS_SWIZZLE_MASK (0xFF << BWRITERVS_SWIZZLE_SHIFT) - #define BWRITERVS_X_X (0) #define BWRITERVS_X_Y (1) #define BWRITERVS_X_Z (2)
Goodbye Józef, you left us too soon.
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- MAINTAINERS | 2 -- 1 file changed, 2 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS index 6606d30ca7f..c4f5b080b2d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -64,7 +64,6 @@ F: dlls/d2d*/ Direct3D M: Henri Verbeet hverbeet@codeweavers.com P: Stefan Dösinger stefan@codeweavers.com -P: Józef Kucia jkucia@codeweavers.com P: Matteo Bruni mbruni@codeweavers.com F: dlls/d3d10*/ F: dlls/d3d11/ @@ -80,7 +79,6 @@ Direct3D helper libraries M: Matteo Bruni mbruni@codeweavers.com P: Henri Verbeet hverbeet@codeweavers.com P: Stefan Dösinger stefan@codeweavers.com -P: Józef Kucia jkucia@codeweavers.com F: dlls/d3dcompiler*/ F: dlls/d3dx10*/ F: dlls/d3dx11*/
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- I guess I need Henri's signoff on this one.
MAINTAINERS | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/MAINTAINERS b/MAINTAINERS index c4f5b080b2d..3e85a26bcea 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -65,7 +65,7 @@ Direct3D M: Henri Verbeet hverbeet@codeweavers.com P: Stefan Dösinger stefan@codeweavers.com P: Matteo Bruni mbruni@codeweavers.com -F: dlls/d3d10*/ +F: dlls/d3d10_core/ F: dlls/d3d11/ F: dlls/d3d12/ F: dlls/d3d8/ @@ -79,6 +79,8 @@ Direct3D helper libraries M: Matteo Bruni mbruni@codeweavers.com P: Henri Verbeet hverbeet@codeweavers.com P: Stefan Dösinger stefan@codeweavers.com +F: dlls/d3d10/ +F: dlls/d3d10_1/ F: dlls/d3dcompiler*/ F: dlls/d3dx10*/ F: dlls/d3dx11*/