Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
October 2021
- 81 participants
- 2597 messages
[PATCH 7/7] d3d10/effect: Remove a bit of a dead code for semantic handling, for anonymous shader variables.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/d3d10/effect.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
index 1823ffdc04b..5a5f9f37e6d 100644
--- a/dlls/d3d10/effect.c
+++ b/dlls/d3d10/effect.c
@@ -1543,13 +1543,6 @@ static HRESULT parse_fx10_anonymous_shader(struct d3d10_effect *e, struct d3d10_
}
TRACE("Variable name: %s.\n", debugstr_a(v->name));
- if (!copy_name(NULL, &v->semantic))
- {
- ERR("Failed to copy semantic.\n");
- return E_OUTOFMEMORY;
- }
- TRACE("Variable semantic: %s.\n", debugstr_a(v->semantic));
-
return S_OK;
}
--
2.33.0
Oct. 1, 2021
[PATCH 6/7] d3d10/effect: Make it clear which assignment types are supported in state groups.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/d3d10/d3d10_private.h | 8 +++++---
dlls/d3d10/effect.c | 25 ++++++++++++++++++-------
2 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/dlls/d3d10/d3d10_private.h b/dlls/d3d10/d3d10_private.h
index f980007427f..3fd17c7400d 100644
--- a/dlls/d3d10/d3d10_private.h
+++ b/dlls/d3d10/d3d10_private.h
@@ -60,9 +60,11 @@ enum d3d10_effect_object_type_flags
enum d3d10_effect_object_operation
{
- D3D10_EOO_VALUE = 1,
- D3D10_EOO_PARSED_OBJECT = 2,
- D3D10_EOO_PARSED_OBJECT_INDEX = 3,
+ D3D10_EOO_CONST = 1,
+ D3D10_EOO_VAR = 2,
+ D3D10_EOO_CONST_INDEX = 3,
+ D3D10_EOO_VAR_INDEX = 4,
+ D3D10_EOO_INDEX_EXPRESSION = 5,
D3D10_EOO_ANONYMOUS_SHADER = 7,
};
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
index 5d5db4eea6c..1823ffdc04b 100644
--- a/dlls/d3d10/effect.c
+++ b/dlls/d3d10/effect.c
@@ -1741,11 +1741,22 @@ static BOOL parse_fx10_state_group(const char *data, size_t data_size,
return FALSE;
}
- if (!read_value_list(data, data_size, value_offset, property_info->type, idx,
- property_info->size, (char *)container + property_info->offset))
+ switch (operation)
{
- ERR("Failed to read values for property %#x.\n", id);
- return FALSE;
+ case D3D10_EOO_CONST:
+
+ /* Constant values output directly to backing store. */
+ if (!read_value_list(data, data_size, value_offset, property_info->type, idx,
+ property_info->size, (char *)container + property_info->offset))
+ {
+ ERR("Failed to read values for property %#x.\n", id);
+ return FALSE;
+ }
+ break;
+
+ default:
+ FIXME("Unhandled operation %#x.\n", operation);
+ return E_FAIL;
}
}
@@ -1787,7 +1798,7 @@ static HRESULT parse_fx10_object(const char *data, size_t data_size,
switch(operation)
{
- case D3D10_EOO_VALUE:
+ case D3D10_EOO_CONST:
TRACE("Copy variable values\n");
switch (o->type)
@@ -1837,7 +1848,7 @@ static HRESULT parse_fx10_object(const char *data, size_t data_size,
}
break;
- case D3D10_EOO_PARSED_OBJECT:
+ case D3D10_EOO_VAR:
/* This is a local object, we've parsed in parse_fx10_local_object. */
if (!fx10_get_string(data, data_size, offset, &name, &name_len))
{
@@ -1849,7 +1860,7 @@ static HRESULT parse_fx10_object(const char *data, size_t data_size,
variable = e->lpVtbl->GetVariableByName(e, name);
break;
- case D3D10_EOO_PARSED_OBJECT_INDEX:
+ case D3D10_EOO_CONST_INDEX:
/* This is a local object, we've parsed in parse_fx10_local_object, which has an array index. */
if (offset >= data_size || !require_space(offset, 2, sizeof(DWORD), data_size))
{
--
2.33.0
Oct. 1, 2021
[PATCH 5/7] d3d10/effect: Use separate enum to describe property container.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
The point is to have pass fields later in same property description data,
and passes are not shader objects, with no corresponding SVT type.
dlls/d3d10/effect.c | 114 ++++++++++++++++++++++++++------------------
1 file changed, 68 insertions(+), 46 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
index 26634895ce1..5d5db4eea6c 100644
--- a/dlls/d3d10/effect.c
+++ b/dlls/d3d10/effect.c
@@ -134,6 +134,27 @@ static inline struct d3d10_effect_variable *impl_from_ID3D10EffectShaderVariable
return CONTAINING_RECORD(iface, struct d3d10_effect_variable, ID3D10EffectVariable_iface);
}
+enum d3d10_effect_container_type
+{
+ D3D10_C_NONE,
+ D3D10_C_RASTERIZER,
+ D3D10_C_DEPTHSTENCIL,
+ D3D10_C_BLEND,
+ D3D10_C_SAMPLER,
+};
+
+static enum d3d10_effect_container_type get_var_container_type(const struct d3d10_effect_variable *v)
+{
+ switch (v->type->basetype)
+ {
+ case D3D10_SVT_DEPTHSTENCIL: return D3D10_C_DEPTHSTENCIL;
+ case D3D10_SVT_BLEND: return D3D10_C_BLEND;
+ case D3D10_SVT_RASTERIZER: return D3D10_C_RASTERIZER;
+ case D3D10_SVT_SAMPLER: return D3D10_C_SAMPLER;
+ default: return D3D10_C_NONE;
+ }
+}
+
struct d3d10_effect_state_property_info
{
UINT id;
@@ -141,55 +162,55 @@ struct d3d10_effect_state_property_info
D3D_SHADER_VARIABLE_TYPE type;
UINT size;
UINT count;
- D3D_SHADER_VARIABLE_TYPE container_type;
+ enum d3d10_effect_container_type container_type;
LONG offset;
};
static const struct d3d10_effect_state_property_info property_info[] =
{
- {0x0c, "RasterizerState.FillMode", D3D10_SVT_INT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, FillMode) },
- {0x0d, "RasterizerState.CullMode", D3D10_SVT_INT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, CullMode) },
- {0x0e, "RasterizerState.FrontCounterClockwise", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, FrontCounterClockwise) },
- {0x0f, "RasterizerState.DepthBias", D3D10_SVT_INT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthBias) },
- {0x10, "RasterizerState.DepthBiasClamp", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthBiasClamp) },
- {0x11, "RasterizerState.SlopeScaledDepthBias", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, SlopeScaledDepthBias) },
- {0x12, "RasterizerState.DepthClipEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthClipEnable) },
- {0x13, "RasterizerState.ScissorEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, ScissorEnable) },
- {0x14, "RasterizerState.MultisampleEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, MultisampleEnable) },
- {0x15, "RasterizerState.AntialiasedLineEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, AntialiasedLineEnable) },
- {0x16, "DepthStencilState.DepthEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthEnable) },
- {0x17, "DepthStencilState.DepthWriteMask", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthWriteMask) },
- {0x18, "DepthStencilState.DepthFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthFunc) },
- {0x19, "DepthStencilState.StencilEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilEnable) },
- {0x1a, "DepthStencilState.StencilReadMask", D3D10_SVT_UINT8, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilReadMask) },
- {0x1b, "DepthStencilState.StencilWriteMask", D3D10_SVT_UINT8, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilWriteMask) },
- {0x1c, "DepthStencilState.FrontFaceStencilFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilFailOp) },
- {0x1d, "DepthStencilState.FrontFaceStencilDepthFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilDepthFailOp)},
- {0x1e, "DepthStencilState.FrontFaceStencilPass", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilPassOp) },
- {0x1f, "DepthStencilState.FrontFaceStencilFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilFunc) },
- {0x20, "DepthStencilState.BackFaceStencilFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilFailOp) },
- {0x21, "DepthStencilState.BackFaceStencilDepthFail", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilDepthFailOp) },
- {0x22, "DepthStencilState.BackFaceStencilPass", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilPassOp) },
- {0x23, "DepthStencilState.BackFaceStencilFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilFunc) },
- {0x24, "BlendState.AlphaToCoverageEnable", D3D10_SVT_BOOL, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, AlphaToCoverageEnable) },
- {0x25, "BlendState.BlendEnable", D3D10_SVT_BOOL, 1, 8, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, BlendEnable) },
- {0x26, "BlendState.SrcBlend", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, SrcBlend) },
- {0x27, "BlendState.DestBlend", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, DestBlend) },
- {0x28, "BlendState.BlendOp", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, BlendOp) },
- {0x29, "BlendState.SrcBlendAlpha", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, SrcBlendAlpha) },
- {0x2a, "BlendState.DestBlendAlpha", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, DestBlendAlpha) },
- {0x2b, "BlendState.BlendOpAlpha", D3D10_SVT_INT, 1, 1, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, BlendOpAlpha) },
- {0x2c, "BlendState.RenderTargetWriteMask", D3D10_SVT_UINT8, 1, 8, D3D10_SVT_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, RenderTargetWriteMask) },
- {0x2d, "SamplerState.Filter", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, Filter) },
- {0x2e, "SamplerState.AddressU", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, AddressU) },
- {0x2f, "SamplerState.AddressV", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, AddressV) },
- {0x30, "SamplerState.AddressW", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, AddressW) },
- {0x31, "SamplerState.MipMapLODBias", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MipLODBias) },
- {0x32, "SamplerState.MaxAnisotropy", D3D10_SVT_UINT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MaxAnisotropy) },
- {0x33, "SamplerState.ComparisonFunc", D3D10_SVT_INT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, ComparisonFunc) },
- {0x34, "SamplerState.BorderColor", D3D10_SVT_FLOAT, 4, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, BorderColor) },
- {0x35, "SamplerState.MinLOD", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MinLOD) },
- {0x36, "SamplerState.MaxLOD", D3D10_SVT_FLOAT, 1, 1, D3D10_SVT_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MaxLOD) },
+ {0x0c, "RasterizerState.FillMode", D3D10_SVT_INT, 1, 1, D3D10_C_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, FillMode) },
+ {0x0d, "RasterizerState.CullMode", D3D10_SVT_INT, 1, 1, D3D10_C_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, CullMode) },
+ {0x0e, "RasterizerState.FrontCounterClockwise", D3D10_SVT_BOOL, 1, 1, D3D10_C_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, FrontCounterClockwise) },
+ {0x0f, "RasterizerState.DepthBias", D3D10_SVT_INT, 1, 1, D3D10_C_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthBias) },
+ {0x10, "RasterizerState.DepthBiasClamp", D3D10_SVT_FLOAT, 1, 1, D3D10_C_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthBiasClamp) },
+ {0x11, "RasterizerState.SlopeScaledDepthBias", D3D10_SVT_FLOAT, 1, 1, D3D10_C_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, SlopeScaledDepthBias) },
+ {0x12, "RasterizerState.DepthClipEnable", D3D10_SVT_BOOL, 1, 1, D3D10_C_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, DepthClipEnable) },
+ {0x13, "RasterizerState.ScissorEnable", D3D10_SVT_BOOL, 1, 1, D3D10_C_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, ScissorEnable) },
+ {0x14, "RasterizerState.MultisampleEnable", D3D10_SVT_BOOL, 1, 1, D3D10_C_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, MultisampleEnable) },
+ {0x15, "RasterizerState.AntialiasedLineEnable", D3D10_SVT_BOOL, 1, 1, D3D10_C_RASTERIZER, FIELD_OFFSET(D3D10_RASTERIZER_DESC, AntialiasedLineEnable) },
+ {0x16, "DepthStencilState.DepthEnable", D3D10_SVT_BOOL, 1, 1, D3D10_C_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthEnable) },
+ {0x17, "DepthStencilState.DepthWriteMask", D3D10_SVT_INT, 1, 1, D3D10_C_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthWriteMask) },
+ {0x18, "DepthStencilState.DepthFunc", D3D10_SVT_INT, 1, 1, D3D10_C_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, DepthFunc) },
+ {0x19, "DepthStencilState.StencilEnable", D3D10_SVT_BOOL, 1, 1, D3D10_C_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilEnable) },
+ {0x1a, "DepthStencilState.StencilReadMask", D3D10_SVT_UINT8, 1, 1, D3D10_C_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilReadMask) },
+ {0x1b, "DepthStencilState.StencilWriteMask", D3D10_SVT_UINT8, 1, 1, D3D10_C_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, StencilWriteMask) },
+ {0x1c, "DepthStencilState.FrontFaceStencilFail", D3D10_SVT_INT, 1, 1, D3D10_C_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilFailOp) },
+ {0x1d, "DepthStencilState.FrontFaceStencilDepthFail", D3D10_SVT_INT, 1, 1, D3D10_C_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilDepthFailOp)},
+ {0x1e, "DepthStencilState.FrontFaceStencilPass", D3D10_SVT_INT, 1, 1, D3D10_C_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilPassOp) },
+ {0x1f, "DepthStencilState.FrontFaceStencilFunc", D3D10_SVT_INT, 1, 1, D3D10_C_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, FrontFace.StencilFunc) },
+ {0x20, "DepthStencilState.BackFaceStencilFail", D3D10_SVT_INT, 1, 1, D3D10_C_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilFailOp) },
+ {0x21, "DepthStencilState.BackFaceStencilDepthFail", D3D10_SVT_INT, 1, 1, D3D10_C_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilDepthFailOp) },
+ {0x22, "DepthStencilState.BackFaceStencilPass", D3D10_SVT_INT, 1, 1, D3D10_C_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilPassOp) },
+ {0x23, "DepthStencilState.BackFaceStencilFunc", D3D10_SVT_INT, 1, 1, D3D10_C_DEPTHSTENCIL, FIELD_OFFSET(D3D10_DEPTH_STENCIL_DESC, BackFace.StencilFunc) },
+ {0x24, "BlendState.AlphaToCoverageEnable", D3D10_SVT_BOOL, 1, 1, D3D10_C_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, AlphaToCoverageEnable) },
+ {0x25, "BlendState.BlendEnable", D3D10_SVT_BOOL, 1, 8, D3D10_C_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, BlendEnable) },
+ {0x26, "BlendState.SrcBlend", D3D10_SVT_INT, 1, 1, D3D10_C_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, SrcBlend) },
+ {0x27, "BlendState.DestBlend", D3D10_SVT_INT, 1, 1, D3D10_C_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, DestBlend) },
+ {0x28, "BlendState.BlendOp", D3D10_SVT_INT, 1, 1, D3D10_C_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, BlendOp) },
+ {0x29, "BlendState.SrcBlendAlpha", D3D10_SVT_INT, 1, 1, D3D10_C_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, SrcBlendAlpha) },
+ {0x2a, "BlendState.DestBlendAlpha", D3D10_SVT_INT, 1, 1, D3D10_C_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, DestBlendAlpha) },
+ {0x2b, "BlendState.BlendOpAlpha", D3D10_SVT_INT, 1, 1, D3D10_C_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, BlendOpAlpha) },
+ {0x2c, "BlendState.RenderTargetWriteMask", D3D10_SVT_UINT8, 1, 8, D3D10_C_BLEND, FIELD_OFFSET(D3D10_BLEND_DESC, RenderTargetWriteMask) },
+ {0x2d, "SamplerState.Filter", D3D10_SVT_INT, 1, 1, D3D10_C_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, Filter) },
+ {0x2e, "SamplerState.AddressU", D3D10_SVT_INT, 1, 1, D3D10_C_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, AddressU) },
+ {0x2f, "SamplerState.AddressV", D3D10_SVT_INT, 1, 1, D3D10_C_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, AddressV) },
+ {0x30, "SamplerState.AddressW", D3D10_SVT_INT, 1, 1, D3D10_C_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, AddressW) },
+ {0x31, "SamplerState.MipMapLODBias", D3D10_SVT_FLOAT, 1, 1, D3D10_C_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MipLODBias) },
+ {0x32, "SamplerState.MaxAnisotropy", D3D10_SVT_UINT, 1, 1, D3D10_C_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MaxAnisotropy) },
+ {0x33, "SamplerState.ComparisonFunc", D3D10_SVT_INT, 1, 1, D3D10_C_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, ComparisonFunc) },
+ {0x34, "SamplerState.BorderColor", D3D10_SVT_FLOAT, 4, 1, D3D10_C_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, BorderColor) },
+ {0x35, "SamplerState.MinLOD", D3D10_SVT_FLOAT, 1, 1, D3D10_C_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MinLOD) },
+ {0x36, "SamplerState.MaxLOD", D3D10_SVT_FLOAT, 1, 1, D3D10_C_SAMPLER, FIELD_OFFSET(D3D10_SAMPLER_DESC, MaxLOD) },
};
static const D3D10_RASTERIZER_DESC default_rasterizer_desc =
@@ -1680,7 +1701,7 @@ static BOOL read_value_list(const char *data, size_t data_size, DWORD offset,
}
static BOOL parse_fx10_state_group(const char *data, size_t data_size,
- const char **ptr, D3D_SHADER_VARIABLE_TYPE container_type, void *container)
+ const char **ptr, enum d3d10_effect_container_type container_type, void *container)
{
const struct d3d10_effect_state_property_info *property_info;
UINT value_offset, operation;
@@ -2310,7 +2331,8 @@ static HRESULT parse_fx10_object_variable(const char *data, size_t data_size,
var = v;
memcpy(&var->u.state.desc, storage_info->default_state, storage_info->size);
- if (!parse_fx10_state_group(data, data_size, ptr, var->type->basetype, &var->u.state.desc))
+ if (!parse_fx10_state_group(data, data_size, ptr, get_var_container_type(var),
+ &var->u.state.desc))
{
ERR("Failed to read property list.\n");
return E_FAIL;
--
2.33.0
Oct. 1, 2021
[PATCH 4/7] d3d10/effect: Reduce duplication in state and shader object release helpers.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/d3d10/d3d10_private.h | 2 ++
dlls/d3d10/effect.c | 40 ++++----------------------------------
2 files changed, 6 insertions(+), 36 deletions(-)
diff --git a/dlls/d3d10/d3d10_private.h b/dlls/d3d10/d3d10_private.h
index 648a7b0240a..f980007427f 100644
--- a/dlls/d3d10/d3d10_private.h
+++ b/dlls/d3d10/d3d10_private.h
@@ -83,6 +83,7 @@ struct d3d10_effect_object
ID3D10VertexShader *vs;
ID3D10PixelShader *ps;
ID3D10GeometryShader *gs;
+ IUnknown *object;
} object;
};
@@ -136,6 +137,7 @@ struct d3d10_effect_state_object_variable
ID3D10DepthStencilState *depth_stencil;
ID3D10BlendState *blend;
ID3D10SamplerState *sampler;
+ IUnknown *object;
} object;
};
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
index 3cd69192f4c..26634895ce1 100644
--- a/dlls/d3d10/effect.c
+++ b/dlls/d3d10/effect.c
@@ -3017,23 +3017,11 @@ static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v)
break;
case D3D10_SVT_DEPTHSTENCIL:
- if (v->u.state.object.depth_stencil)
- ID3D10DepthStencilState_Release(v->u.state.object.depth_stencil);
- break;
-
case D3D10_SVT_BLEND:
- if (v->u.state.object.blend)
- ID3D10BlendState_Release(v->u.state.object.blend);
- break;
-
case D3D10_SVT_RASTERIZER:
- if (v->u.state.object.rasterizer)
- ID3D10RasterizerState_Release(v->u.state.object.rasterizer);
- break;
-
case D3D10_SVT_SAMPLER:
- if (v->u.state.object.sampler)
- ID3D10SamplerState_Release(v->u.state.object.sampler);
+ if (v->u.state.object.object)
+ IUnknown_Release(v->u.state.object.object);
break;
case D3D10_SVT_TEXTURE1D:
@@ -3076,33 +3064,13 @@ static void d3d10_effect_object_destroy(struct d3d10_effect_object *o)
switch (o->type)
{
case D3D10_EOT_RASTERIZER_STATE:
- if (o->object.rs)
- ID3D10RasterizerState_Release(o->object.rs);
- break;
-
case D3D10_EOT_DEPTH_STENCIL_STATE:
- if (o->object.ds)
- ID3D10DepthStencilState_Release(o->object.ds);
- break;
-
case D3D10_EOT_BLEND_STATE:
- if (o->object.bs)
- ID3D10BlendState_Release(o->object.bs);
- break;
-
case D3D10_EOT_VERTEXSHADER:
- if (o->object.vs)
- ID3D10VertexShader_Release(o->object.vs);
- break;
-
case D3D10_EOT_PIXELSHADER:
- if (o->object.ps)
- ID3D10PixelShader_Release(o->object.ps);
- break;
-
case D3D10_EOT_GEOMETRYSHADER:
- if (o->object.gs)
- ID3D10GeometryShader_Release(o->object.gs);
+ if (o->object.object)
+ IUnknown_Release(o->object.object);
break;
default:
--
2.33.0
Oct. 1, 2021
[PATCH 3/7] d3d10/effect: Remove unused field from pass structure.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/d3d10/d3d10_private.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/dlls/d3d10/d3d10_private.h b/dlls/d3d10/d3d10_private.h
index 38733862753..648a7b0240a 100644
--- a/dlls/d3d10/d3d10_private.h
+++ b/dlls/d3d10/d3d10_private.h
@@ -223,7 +223,6 @@ struct d3d10_effect_pass
struct d3d10_effect_technique *technique;
char *name;
- DWORD start;
DWORD object_count;
DWORD annotation_count;
struct d3d10_effect_object *objects;
--
2.33.0
Oct. 1, 2021
[PATCH 2/7] d3d10/effect: Set corresponding flag for pooled variables.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/d3d10/d3d10_private.h | 1 +
dlls/d3d10/effect.c | 26 +++++++---
dlls/d3d10/tests/effect.c | 100 +++++++++++++++++++++++++------------
3 files changed, 88 insertions(+), 39 deletions(-)
diff --git a/dlls/d3d10/d3d10_private.h b/dlls/d3d10/d3d10_private.h
index e7ecfb73a64..38733862753 100644
--- a/dlls/d3d10/d3d10_private.h
+++ b/dlls/d3d10/d3d10_private.h
@@ -259,6 +259,7 @@ struct d3d10_effect_anonymous_shader
enum d3d10_effect_flags
{
D3D10_EFFECT_OPTIMIZED = 0x1,
+ D3D10_EFFECT_IS_POOL = 0x2,
};
/* ID3D10Effect */
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
index 8ff7ed53963..3cd69192f4c 100644
--- a/dlls/d3d10/effect.c
+++ b/dlls/d3d10/effect.c
@@ -1405,6 +1405,9 @@ static HRESULT parse_fx10_variable_head(const char *data, size_t data_size,
v->explicit_bind_point = ~0u;
+ if (v->effect->flags & D3D10_EFFECT_IS_POOL)
+ v->flag |= D3D10_EFFECT_VARIABLE_POOLED;
+
return copy_variableinfo_from_type(v);
}
@@ -1435,7 +1438,7 @@ static HRESULT parse_fx10_annotation(const char *data, size_t data_size,
}
/* mark the variable as annotation */
- a->flag = D3D10_EFFECT_VARIABLE_ANNOTATION;
+ a->flag |= D3D10_EFFECT_VARIABLE_ANNOTATION;
return S_OK;
}
@@ -2083,7 +2086,7 @@ static HRESULT parse_fx10_technique(const char *data, size_t data_size,
static HRESULT parse_fx10_numeric_variable(const char *data, size_t data_size,
const char **ptr, BOOL local, struct d3d10_effect_variable *v)
{
- DWORD offset, default_value_offset;
+ DWORD offset, flags, default_value_offset;
HRESULT hr;
if (FAILED(hr = parse_fx10_variable_head(data, data_size, ptr, v)))
@@ -2104,8 +2107,10 @@ static HRESULT parse_fx10_numeric_variable(const char *data, size_t data_size,
read_dword(ptr, &default_value_offset);
- read_dword(ptr, &v->flag);
- TRACE("Variable flag: %#x.\n", v->flag);
+ read_dword(ptr, &flags);
+ TRACE("Variable flags: %#x.\n", flags);
+
+ v->flag |= flags;
if (local)
{
@@ -2451,6 +2456,9 @@ static HRESULT parse_fx10_buffer(const char *data, size_t data_size, const char
read_dword(ptr, &l->explicit_bind_point);
TRACE("%s buffer explicit bind point: %#x.\n", prefix, l->explicit_bind_point);
+ if (l->effect->flags & D3D10_EFFECT_IS_POOL)
+ l->flag |= D3D10_EFFECT_VARIABLE_POOLED;
+
if (local)
{
read_dword(ptr, &l->annotation_count);
@@ -8590,7 +8598,7 @@ static int d3d10_effect_type_compare(const void *key, const struct wine_rb_entry
}
static HRESULT d3d10_create_effect(void *data, SIZE_T data_size, ID3D10Device *device,
- ID3D10Effect *pool, const ID3D10EffectVtbl *vtbl, struct d3d10_effect **effect)
+ ID3D10Effect *pool, unsigned int flags, struct d3d10_effect **effect)
{
struct d3d10_effect *object;
HRESULT hr;
@@ -8599,12 +8607,14 @@ static HRESULT d3d10_create_effect(void *data, SIZE_T data_size, ID3D10Device *d
return E_OUTOFMEMORY;
wine_rb_init(&object->types, d3d10_effect_type_compare);
- object->ID3D10Effect_iface.lpVtbl = vtbl;
+ object->ID3D10Effect_iface.lpVtbl = flags & D3D10_EFFECT_IS_POOL ?
+ &d3d10_effect_pool_effect_vtbl : &d3d10_effect_vtbl;
object->ID3D10EffectPool_iface.lpVtbl = &d3d10_effect_pool_vtbl;
object->refcount = 1;
ID3D10Device_AddRef(device);
object->device = device;
object->pool = pool;
+ object->flags = flags;
if (pool) pool->lpVtbl->AddRef(pool);
hr = d3d10_effect_parse(object, data, data_size);
@@ -8643,7 +8653,7 @@ HRESULT WINAPI D3D10CreateEffectFromMemory(void *data, SIZE_T data_size, UINT fl
}
}
- if (FAILED(hr = d3d10_create_effect(data, data_size, device, pool, &d3d10_effect_vtbl, &object)))
+ if (FAILED(hr = d3d10_create_effect(data, data_size, device, pool, 0, &object)))
{
WARN("Failed to create an effect, hr %#x.\n", hr);
}
@@ -8697,7 +8707,7 @@ HRESULT WINAPI D3D10CreateEffectPoolFromMemory(void *data, SIZE_T data_size, UIN
data, data_size, fx_flags, device, effect_pool);
if (FAILED(hr = d3d10_create_effect(data, data_size, device, NULL,
- &d3d10_effect_pool_effect_vtbl, &object)))
+ D3D10_EFFECT_IS_POOL, &object)))
{
WARN("Failed to create an effect, hr %#x.\n", hr);
return hr;
diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c
index f7b536b2fb0..2cef4d425f3 100644
--- a/dlls/d3d10/tests/effect.c
+++ b/dlls/d3d10/tests/effect.c
@@ -1519,7 +1519,7 @@ static void test_effect_variable_type_class(void)
ok(strcmp(vd.Name, "s") == 0, "Name is \"%s\", expected \"s\"\n", vd.Name);
ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
- ok(vd.Flags == 2, "Flags is %u, expected 2\n", vd.Flags);
+ ok(vd.Flags == D3D10_EFFECT_VARIABLE_ANNOTATION, "Unexpected flags %#x.\n", vd.Flags);
ok(vd.Annotations == 0, "Annotations is %u, expected 0\n", vd.Annotations);
ok(vd.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vd.BufferOffset);
ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
@@ -6321,7 +6321,7 @@ static void test_effect_shader_object(void)
}
#if 0
-cbuffer s_cb
+cbuffer s_cb <String s = "value"; >
{
float f1 : COLOR0;
float f2 : COLOR1;
@@ -6331,6 +6331,11 @@ BlendState s_blendstate;
Texture2D s_texture;
PixelShader ps;
+float4 VS( float4 pos : POSITION ) : SV_POSITION
+{
+ return f1.xxxx;
+}
+
technique10 tech
{
pass P0
@@ -6339,29 +6344,54 @@ technique10 tech
SetVertexShader(NULL);
SetGeometryShader(NULL);
}
+
+ pass P1
+ {
+ SetVertexShader(CompileShader(vs_4_0, VS()));
+ }
};
#endif
static DWORD fx_test_pool[] =
{
- 0x43425844, 0x92a09896, 0xbc72ed33, 0x77194b8a, 0xb1132991, 0x00000001, 0x00000242, 0x00000001,
- 0x00000024, 0x30315846, 0x00000216, 0xfeff1001, 0x00000001, 0x00000002, 0x00000003, 0x00000000,
- 0x00000000, 0x00000000, 0x00000001, 0x000000ee, 0x00000000, 0x00000001, 0x00000000, 0x00000001,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x62635f73,
- 0x6f6c6600, 0x09007461, 0x01000000, 0x00000000, 0x04000000, 0x10000000, 0x04000000, 0x09000000,
- 0x66000009, 0x4f430031, 0x30524f4c, 0x00326600, 0x4f4c4f43, 0x42003152, 0x646e656c, 0x74617453,
- 0x003f0065, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00020000, 0x5f730000,
- 0x6e656c62, 0x61747364, 0x54006574, 0x75747865, 0x44326572, 0x00007300, 0x00000200, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000c00, 0x745f7300, 0x75747865, 0x50006572, 0x6c657869,
- 0x64616853, 0xa3007265, 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x05000000,
- 0x70000000, 0x65740073, 0x50006863, 0x00010030, 0x00020000, 0x00000000, 0x00010000, 0x00020000,
- 0x00000000, 0x00040000, 0x00100000, 0x00000000, 0x00020000, 0xffff0000, 0x0000ffff, 0x002b0000,
- 0x000f0000, 0x002e0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00350000, 0x000f0000,
- 0x00380000, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0x00660000, 0x004a0000, 0x00000000,
- 0xffff0000, 0x0000ffff, 0x00000000, 0x00990000, 0x007d0000, 0x00000000, 0xffff0000, 0x0000ffff,
- 0x00cb0000, 0x00af0000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00000000, 0x00ce0000, 0x00010000,
- 0x00000000, 0x00d30000, 0x00030000, 0x00000000, 0x00070000, 0x00000000, 0x00020000, 0x00cb0000,
- 0x00060000, 0x00000000, 0x00010000, 0x00d60000, 0x00080000, 0x00000000, 0x00010000, 0x00e20000,
- 0x00000000,
+ 0x43425844, 0x5a29c5ce, 0xa6970df1, 0x3b2ae8f2, 0x7b225509, 0x00000001, 0x000004dc, 0x00000001,
+ 0x00000024, 0x30315846, 0x000004b0, 0xfeff1001, 0x00000001, 0x00000002, 0x00000003, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000001, 0x00000360, 0x00000000, 0x00000001, 0x00000000, 0x00000001,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x62635f73,
+ 0x72745300, 0x00676e69, 0x00000009, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000001, 0x61760073, 0x0065756c, 0x616f6c66, 0x00340074, 0x00010000, 0x00000000, 0x00040000,
+ 0x00100000, 0x00040000, 0x09090000, 0x31660000, 0x4c4f4300, 0x0030524f, 0x43003266, 0x524f4c4f,
+ 0x6c420031, 0x53646e65, 0x65746174, 0x00006a00, 0x00000200, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000200, 0x625f7300, 0x646e656c, 0x74617473, 0x65540065, 0x72757478, 0x00443265,
+ 0x0000009e, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000000c, 0x65745f73,
+ 0x72757478, 0x69500065, 0x536c6578, 0x65646168, 0x00ce0072, 0x00020000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00050000, 0x73700000, 0x63657400, 0x30500068, 0x00000100, 0x00000200,
+ 0x00000000, 0x00000100, 0x00000200, 0x00000000, 0x00315000, 0x00000238, 0x43425844, 0x37b3f12d,
+ 0x2579b942, 0x27ed5925, 0x4a80132c, 0x00000001, 0x00000238, 0x00000005, 0x00000034, 0x00000108,
+ 0x0000013c, 0x00000170, 0x000001bc, 0x46454452, 0x000000cc, 0x00000001, 0x00000044, 0x00000001,
+ 0x0000001c, 0xfffe0400, 0x00000100, 0x000000a3, 0x0000003c, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x62635f73, 0xababab00, 0x0000003c, 0x00000002,
+ 0x0000005c, 0x00000010, 0x00000000, 0x00000000, 0x0000008c, 0x00000000, 0x00000004, 0x00000002,
+ 0x00000090, 0x00000000, 0x000000a0, 0x00000004, 0x00000004, 0x00000000, 0x00000090, 0x00000000,
+ 0xab003166, 0x00030000, 0x00010001, 0x00000000, 0x00000000, 0x4d003266, 0x6f726369, 0x74666f73,
+ 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e,
+ 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003,
+ 0x00000000, 0x0000000f, 0x49534f50, 0x4e4f4954, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001,
+ 0x00000008, 0x00000020, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x505f5653,
+ 0x5449534f, 0x004e4f49, 0x52444853, 0x00000044, 0x00010040, 0x00000011, 0x04000059, 0x00208e46,
+ 0x00000000, 0x00000001, 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x06000036, 0x001020f2,
+ 0x00000000, 0x00208006, 0x00000000, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000002,
+ 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000011c, 0x00000000, 0x00000004, 0x00000010,
+ 0x00000000, 0x00000002, 0xffffffff, 0x00000001, 0x0000002c, 0x00000010, 0x0000002e, 0x00000056,
+ 0x0000003a, 0x00000059, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000060, 0x0000003a,
+ 0x00000063, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000091, 0x00000075, 0x00000000,
+ 0xffffffff, 0x00000000, 0x00000000, 0x000000c4, 0x000000a8, 0x00000000, 0xffffffff, 0x00000000,
+ 0x000000f6, 0x000000da, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x000000f9, 0x00000002,
+ 0x00000000, 0x000000fe, 0x00000003, 0x00000000, 0x00000007, 0x00000000, 0x00000002, 0x000000f6,
+ 0x00000006, 0x00000000, 0x00000001, 0x00000101, 0x00000008, 0x00000000, 0x00000001, 0x0000010d,
+ 0x00000119, 0x00000001, 0x00000000, 0x00000006, 0x00000000, 0x00000007, 0x00000358,
};
/* Compiled as a child with /Gch (D3DCOMPILE_EFFECT_CHILD_EFFECT) */
@@ -6476,8 +6506,8 @@ static void test_effect_pool(void)
ID3D10EffectPool *pool, *pool2;
ID3D10EffectConstantBuffer *cb;
ID3D10EffectShaderVariable *sv;
+ ID3D10EffectVariable *v, *a;
ID3D10EffectTechnique *t;
- ID3D10EffectVariable *v;
ID3D10EffectPass *pass;
D3D10_EFFECT_DESC desc;
ID3D10Buffer *buffer;
@@ -6555,28 +6585,41 @@ todo_wine
hr = cb->lpVtbl->GetDesc(cb, &var_desc);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(!strcmp(var_desc.Name, "s_cb"), "Unexpected name %s.\n", var_desc.Name);
-todo_wine
ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags);
+ a = cb->lpVtbl->GetAnnotationByIndex(cb, 0);
+ ok(a->lpVtbl->IsValid(a), "Expected valid annotation.\n");
+ hr = a->lpVtbl->GetDesc(a, &var_desc);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ ok(!strcmp(var_desc.Name, "s"), "Unexpected name %s.\n", var_desc.Name);
+ ok(var_desc.Flags == (D3D10_EFFECT_VARIABLE_POOLED | D3D10_EFFECT_VARIABLE_ANNOTATION),
+ "Unexpected flags %#x.\n", var_desc.Flags);
+
+ t = effect->lpVtbl->GetTechniqueByIndex(effect, 0);
+ pass = t->lpVtbl->GetPassByName(t, "P1");
+ ok(pass->lpVtbl->IsValid(pass), "Expected valid pass.\n");
+ hr = pass->lpVtbl->GetVertexShaderDesc(pass, &shader_desc);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ hr = shader_desc.pShaderVariable->lpVtbl->GetDesc(shader_desc.pShaderVariable, &var_desc);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ ok(!strcmp(var_desc.Name, "$Anonymous"), "Unexpected name %s.\n", var_desc.Name);
+ ok(!var_desc.Flags, "Unexpected flags %#x.\n", var_desc.Flags);
v = effect->lpVtbl->GetVariableByName(effect, "s_blendstate");
hr = v->lpVtbl->GetDesc(v, &var_desc);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(!strcmp(var_desc.Name, "s_blendstate"), "Unexpected name %s.\n", var_desc.Name);
-todo_wine
ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags);
v = effect->lpVtbl->GetVariableByName(effect, "s_texture");
hr = v->lpVtbl->GetDesc(v, &var_desc);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(!strcmp(var_desc.Name, "s_texture"), "Unexpected name %s.\n", var_desc.Name);
-todo_wine
ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags);
v = effect->lpVtbl->GetVariableByName(effect, "ps");
hr = v->lpVtbl->GetDesc(v, &var_desc);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(!strcmp(var_desc.Name, "ps"), "Unexpected name %s.\n", var_desc.Name);
-todo_wine
ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags);
t = effect->lpVtbl->GetTechniqueByIndex(effect, 0);
@@ -6716,7 +6759,6 @@ todo_wine
hr = cb->lpVtbl->GetDesc(cb, &var_desc);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(!strcmp(var_desc.Name, "s_cb"), "Unexpected name %s.\n", var_desc.Name);
-todo_wine
ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags);
/* Pool techniques are not accessible */
@@ -6749,21 +6791,18 @@ todo_wine
hr = v->lpVtbl->GetDesc(v, &var_desc);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(!strcmp(var_desc.Name, "f1"), "Unexpected name %s.\n", var_desc.Name);
-todo_wine
ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags);
v = child_effect->lpVtbl->GetVariableByIndex(child_effect, 4);
hr = v->lpVtbl->GetDesc(v, &var_desc);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(!strcmp(var_desc.Name, "f2"), "Unexpected name %s.\n", var_desc.Name);
-todo_wine
ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags);
v = child_effect->lpVtbl->GetVariableByName(child_effect, "s_texture");
hr = v->lpVtbl->GetDesc(v, &var_desc);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(!strcmp(var_desc.Name, "s_texture"), "Unexpected name %s.\n", var_desc.Name);
-todo_wine
ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags);
v = child_effect->lpVtbl->GetVariableBySemantic(child_effect, "COLOR0");
@@ -6776,7 +6815,6 @@ todo_wine
hr = v->lpVtbl->GetDesc(v, &var_desc);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(!strcmp(var_desc.Name, "f2"), "Unexpected name %s.\n", var_desc.Name);
-todo_wine
ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags);
child_effect->lpVtbl->Release(child_effect);
--
2.33.0
Oct. 1, 2021
[v2 PATCH 1/7] d3d10/effect: Fix handling samplers array binding.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/d3d10/effect.c | 50 ++++++++++++---------
dlls/d3d10/tests/effect.c | 91 +++++++++++++++++++++++++++++++++++++++
2 files changed, 121 insertions(+), 20 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
index 70a99601eea..8ff7ed53963 100644
--- a/dlls/d3d10/effect.c
+++ b/dlls/d3d10/effect.c
@@ -3973,6 +3973,29 @@ static void update_buffer(ID3D10Device *device, struct d3d10_effect_variable *v)
b->changed = FALSE;
}
+static void set_sampler(ID3D10Device *device, D3D10_SHADER_VARIABLE_TYPE shader_type,
+ struct d3d10_effect_variable *v, unsigned int bind_point)
+{
+ switch (shader_type)
+ {
+ case D3D10_SVT_VERTEXSHADER:
+ ID3D10Device_VSSetSamplers(device, bind_point, 1, &v->u.state.object.sampler);
+ break;
+
+ case D3D10_SVT_PIXELSHADER:
+ ID3D10Device_PSSetSamplers(device, bind_point, 1, &v->u.state.object.sampler);
+ break;
+
+ case D3D10_SVT_GEOMETRYSHADER:
+ ID3D10Device_GSSetSamplers(device, bind_point, 1, &v->u.state.object.sampler);
+ break;
+
+ default:
+ WARN("Incorrect shader type to bind sampler.\n");
+ break;
+ }
+}
+
static void apply_shader_resources(ID3D10Device *device, struct ID3D10EffectShaderVariable *variable)
{
struct d3d10_effect_variable *v = impl_from_ID3D10EffectShaderVariable(variable);
@@ -3980,7 +4003,7 @@ static void apply_shader_resources(ID3D10Device *device, struct ID3D10EffectShad
struct d3d10_effect_shader_resource *sr;
struct d3d10_effect_variable *rsrc_v;
ID3D10ShaderResourceView **srv;
- unsigned int i;
+ unsigned int i, j;
for (i = 0; i < sv->resource_count; ++i)
{
@@ -4045,27 +4068,14 @@ static void apply_shader_resources(ID3D10Device *device, struct ID3D10EffectShad
break;
case D3D10_SIT_SAMPLER:
- switch (v->type->basetype)
+ if (!rsrc_v->type->element_count)
{
- case D3D10_SVT_VERTEXSHADER:
- ID3D10Device_VSSetSamplers(device, sr->bind_point, sr->bind_count,
- &rsrc_v->u.state.object.sampler);
- break;
-
- case D3D10_SVT_PIXELSHADER:
- ID3D10Device_PSSetSamplers(device, sr->bind_point, sr->bind_count,
- &rsrc_v->u.state.object.sampler);
- break;
-
- case D3D10_SVT_GEOMETRYSHADER:
- ID3D10Device_GSSetSamplers(device, sr->bind_point, sr->bind_count,
- &rsrc_v->u.state.object.sampler);
- break;
-
- default:
- WARN("Incorrect shader type to bind sampler.\n");
- break;
+ set_sampler(device, v->type->basetype, rsrc_v, sr->bind_point);
+ break;
}
+
+ for (j = 0; j < sr->bind_count; ++j)
+ set_sampler(device, v->type->basetype, &rsrc_v->elements[j], sr->bind_point + j);
break;
default:
diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c
index 60be8186f8b..f7b536b2fb0 100644
--- a/dlls/d3d10/tests/effect.c
+++ b/dlls/d3d10/tests/effect.c
@@ -5769,6 +5769,55 @@ static DWORD fx_test_resource_variable[] =
0x00070000, 0x02120000, 0x00070000, 0x00000000, 0x00070000, 0x057a0000, 0x00000000,
};
+#if 0
+Texture2D t_a[2];
+
+SamplerState s[2] : register(s1);
+
+float4 PS( float4 pos : SV_POSITION ) : SV_Target
+{
+ return t_a[1].Sample(s[1], float2(0, 0));
+}
+
+technique10 rsrc_test
+{
+ pass p0
+ {
+ SetPixelShader(CompileShader(ps_4_0, PS()));
+ }
+}
+#endif
+static DWORD fx_test_resource_variable2[] =
+{
+ 0x43425844, 0xb62313ac, 0x8116090b, 0xdc1d2951, 0xfc18ca42, 0x00000001, 0x0000035a, 0x00000001,
+ 0x00000024, 0x30315846, 0x0000032e, 0xfeff1001, 0x00000000, 0x00000000, 0x00000002, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000001, 0x0000028a, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x74786554,
+ 0x32657275, 0x00040044, 0x00020000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x000c0000,
+ 0x5f740000, 0x61530061, 0x656c706d, 0x61745372, 0x2e006574, 0x02000000, 0x02000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x15000000, 0x73000000, 0x72737200, 0x65745f63, 0x70007473, 0x02180030,
+ 0x58440000, 0xb2424342, 0x3c889e83, 0xb8b8fc18, 0x749f2920, 0x0001877a, 0x02180000, 0x00050000,
+ 0x00340000, 0x00c80000, 0x00fc0000, 0x01300000, 0x019c0000, 0x44520000, 0x008c4645, 0x00000000,
+ 0x00000000, 0x00020000, 0x001c0000, 0x04000000, 0x0100ffff, 0x00620000, 0x005c0000, 0x00030000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00020000, 0x00010000, 0x005e0000, 0x00020000,
+ 0x00050000, 0x00040000, 0xffff0000, 0x0000ffff, 0x00020000, 0x000c0000, 0x00730000, 0x00615f74,
+ 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d,
+ 0x31207265, 0x00312e30, 0x5349abab, 0x002c4e47, 0x00010000, 0x00080000, 0x00200000, 0x00000000,
+ 0x00010000, 0x00030000, 0x00000000, 0x000f0000, 0x56530000, 0x534f505f, 0x4f495449, 0x534f004e,
+ 0x002c4e47, 0x00010000, 0x00080000, 0x00200000, 0x00000000, 0x00000000, 0x00030000, 0x00000000,
+ 0x000f0000, 0x56530000, 0x7261545f, 0x00746567, 0x4853abab, 0x00645244, 0x00400000, 0x00190000,
+ 0x005a0000, 0x60000300, 0x00020010, 0x18580000, 0x70000400, 0x00010010, 0x55550000, 0x00650000,
+ 0x20f20300, 0x00000010, 0x00450000, 0x20f20c00, 0x00000010, 0x40020000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x7e460000, 0x00010010, 0x60000000, 0x00020010, 0x003e0000, 0x54530100,
+ 0x00745441, 0x00020000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00660000, 0x00000000,
+ 0x002a0000, 0x000e0000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00570000, 0x003b0000, 0x00000000,
+ 0xffff0000, 0x0000ffff, 0x00000000, 0x00000000, 0x00590000, 0x00010000, 0x00000000, 0x00630000,
+ 0x00010000, 0x00000000, 0x00070000, 0x00000000, 0x00070000, 0x02820000, 0x00000000,
+};
+
static void create_effect_texture_resource(ID3D10Device *device, ID3D10ShaderResourceView **srv,
ID3D10Texture2D **tex)
{
@@ -5812,10 +5861,13 @@ static ID3D10EffectShaderResourceVariable *get_effect_shader_resource_variable_(
static void test_effect_resource_variable(void)
{
+ ID3D10SamplerState *samplers[D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT];
ID3D10ShaderResourceView *srv0, *srv_a[2], *srv_tmp[2];
ID3D10EffectShaderResourceVariable *t0, *t_a, *t_a_0;
ID3D10EffectTechnique *technique;
ID3D10Texture2D *tex0, *tex_a[2];
+ ID3D10EffectSamplerVariable *s;
+ ID3D10SamplerState *sampler[2];
D3D10_EFFECT_DESC effect_desc;
D3D10_PASS_DESC pass_desc;
ID3D10EffectVariable *var;
@@ -5938,6 +5990,45 @@ static void test_effect_resource_variable(void)
effect->lpVtbl->Release(effect);
+ hr = create_effect(fx_test_resource_variable2, 0, device, NULL, &effect);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+
+ technique = effect->lpVtbl->GetTechniqueByName(effect, "rsrc_test");
+ ok(!!technique, "Got unexpected technique %p.\n", technique);
+ pass = technique->lpVtbl->GetPassByName(technique, "p0");
+ ok(!!pass, "Got unexpected pass %p.\n", pass);
+
+ var = effect->lpVtbl->GetVariableByName(effect, "s");
+ ok(var->lpVtbl->IsValid(var), "Expected valid variable.\n");
+
+ s = var->lpVtbl->AsSampler(var);
+ ok(s->lpVtbl->IsValid(s), "Expected valid sample variable.\n");
+
+ hr = s->lpVtbl->GetSampler(s, 0, &sampler[0]);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ hr = s->lpVtbl->GetSampler(s, 1, &sampler[1]);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ hr = pass->lpVtbl->Apply(pass, 0);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+
+ ID3D10Device_PSGetSamplers(device, 0, ARRAY_SIZE(samplers), samplers);
+ for (i = 0; i < ARRAY_SIZE(samplers); ++i)
+ {
+ if (i == 1 || i == 2)
+ {
+ ok(samplers[i] == sampler[i - 1], "Unexpected sampler at %u.\n", i);
+ }
+ else
+ ok(!samplers[i], "Unexpected sampler at %u.\n", i);
+ if (samplers[i])
+ ID3D10SamplerState_Release(samplers[i]);
+ }
+ for (i = 0; i < ARRAY_SIZE(sampler); ++i)
+ ID3D10SamplerState_Release(sampler[i]);
+
+ effect->lpVtbl->Release(effect);
+
refcount = ID3D10Device_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
}
--
2.33.0
Oct. 1, 2021
[PATCH 2/2] vbscript: Handle Recursive calls.
by Robert Wilhelm
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50758
Signed-off-by: Robert Wilhelm <robert.wilhelm(a)gmx.net>
---
dlls/vbscript/interp.c | 14 ++++++++------
dlls/vbscript/tests/lang.vbs | 24 ++++++++++++++++++++++++
dlls/vbscript/vbscript.h | 1 +
3 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c
index e2c1d5cc53d..6064eea5bb0 100644
--- a/dlls/vbscript/interp.c
+++ b/dlls/vbscript/interp.c
@@ -134,7 +134,9 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_
DISPID id;
HRESULT hres;
- if((ctx->func->type == FUNC_FUNCTION || ctx->func->type == FUNC_PROPGET)
+ TRACE("%s %d\n", debugstr_w(name), invoke_type);
+
+ if((invoke_type != VBDISP_CALLGET) && (ctx->func->type == FUNC_FUNCTION || ctx->func->type == FUNC_PROPGET)
&& !wcsicmp(name, ctx->func->name)) {
ref->type = REF_VAR;
ref->u.v = &ctx->ret_val;
@@ -615,7 +617,7 @@ static HRESULT variant_call(exec_ctx_t *ctx, VARIANT *v, unsigned arg_cnt, VARIA
return S_OK;
}
-static HRESULT do_icall(exec_ctx_t *ctx, VARIANT *res, BSTR identifier, unsigned arg_cnt)
+static HRESULT do_icall(exec_ctx_t *ctx, VARIANT *res, BSTR identifier, vbdisp_invoke_type_t invoke_type, unsigned arg_cnt)
{
DISPPARAMS dp;
ref_t ref;
@@ -623,7 +625,7 @@ static HRESULT do_icall(exec_ctx_t *ctx, VARIANT *res, BSTR identifier, unsigned
TRACE("%s %u\n", debugstr_w(identifier), arg_cnt);
- hres = lookup_identifier(ctx, identifier, VBDISP_CALLGET, &ref);
+ hres = lookup_identifier(ctx, identifier, invoke_type, &ref);
if(FAILED(hres))
return hres;
@@ -692,7 +694,7 @@ static HRESULT interp_icall(exec_ctx_t *ctx)
TRACE("\n");
- hres = do_icall(ctx, &v, identifier, arg_cnt);
+ hres = do_icall(ctx, &v, identifier, VBDISP_CALLGET, arg_cnt);
if(FAILED(hres))
return hres;
@@ -706,7 +708,7 @@ static HRESULT interp_icallv(exec_ctx_t *ctx)
TRACE("\n");
- return do_icall(ctx, NULL, identifier, arg_cnt);
+ return do_icall(ctx, NULL, identifier, VBDISP_CALLGET, arg_cnt);
}
static HRESULT interp_vcall(exec_ctx_t *ctx)
@@ -800,7 +802,7 @@ static HRESULT interp_ident(exec_ctx_t *ctx)
TRACE("%s\n", debugstr_w(identifier));
- hres = do_icall(ctx, &v, identifier, 0);
+ hres = do_icall(ctx, &v, identifier, VBDISP_IDENT, 0);
if(FAILED(hres))
return hres;
diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs
index d7865301784..dc2acbae69c 100644
--- a/dlls/vbscript/tests/lang.vbs
+++ b/dlls/vbscript/tests/lang.vbs
@@ -1882,6 +1882,30 @@ set arr(0) = new TestPropSyntax
arr(0).prop = 1
ok arr(0).prop = 1, "arr(0) = " & arr(0).prop
+function recursingfunction(x)
+ if (x) then exit function
+ recursingfunction = 2
+ dim y
+ y = recursingfunction
+ call ok(y = 2, "y = " & y)
+ recursingfunction = 1
+ call recursingfunction(True)
+end function
+call ok(recursingfunction(False) = 1, "unexpected return value " & recursingfunction(False))
+
+x = false
+function recursingfunction2
+ if (x) then exit function
+ recursingfunction2 = 2
+ dim y
+ y = recursingfunction2
+ call ok(y = 2, "y = " & y)
+ recursingfunction2 = 1
+ x = true
+ recursingfunction2()
+end function
+call ok(recursingfunction2() = 1, "unexpected return value " & recursingfunction2())
+
function f2(x,y)
end function
diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h
index f5353b33cae..b23df0fc589 100644
--- a/dlls/vbscript/vbscript.h
+++ b/dlls/vbscript/vbscript.h
@@ -57,6 +57,7 @@ typedef struct _vbdisp_t vbdisp_t;
typedef enum {
VBDISP_CALLGET,
+ VBDISP_IDENT,
VBDISP_LET,
VBDISP_SET,
VBDISP_ANY
--
2.31.1
Oct. 1, 2021
[PATCH 1/2] vbscript: introduce ident bytecode.
by Robert Wilhelm
Patch by Jacek Caban.
Signed-off-by: Robert Wilhelm <robert.wilhelm(a)gmx.net>
---
dlls/vbscript/compile.c | 21 ++++++++++++++++++---
dlls/vbscript/interp.c | 29 ++++++++++++++++++++++++-----
dlls/vbscript/vbscript.h | 1 +
3 files changed, 43 insertions(+), 8 deletions(-)
diff --git a/dlls/vbscript/compile.c b/dlls/vbscript/compile.c
index 821d85310b6..da56eac74b2 100644
--- a/dlls/vbscript/compile.c
+++ b/dlls/vbscript/compile.c
@@ -446,7 +446,8 @@ static HRESULT compile_args(compile_ctx_t *ctx, expression_t *args, unsigned *re
return S_OK;
}
-static HRESULT compile_member_expression(compile_ctx_t *ctx, member_expression_t *expr, unsigned arg_cnt, BOOL ret_val)
+static HRESULT compile_member_call_expression(compile_ctx_t *ctx, member_expression_t *expr,
+ unsigned arg_cnt, BOOL ret_val)
{
HRESULT hres;
@@ -471,6 +472,20 @@ static HRESULT compile_member_expression(compile_ctx_t *ctx, member_expression_t
return hres;
}
+static HRESULT compile_member_expression(compile_ctx_t *ctx, member_expression_t *expr)
+{
+ expression_t *const_expr;
+
+ if (expr->obj_expr) /* FIXME: we should probably have a dedicated opcode as well */
+ return compile_member_call_expression(ctx, expr, 0, TRUE);
+
+ const_expr = lookup_const_decls(ctx, expr->identifier, TRUE);
+ if(const_expr)
+ return compile_expression(ctx, const_expr);
+
+ return push_instr_bstr(ctx, OP_ident, expr->identifier);
+}
+
static HRESULT compile_call_expression(compile_ctx_t *ctx, call_expression_t *expr, BOOL ret_val)
{
unsigned arg_cnt = 0;
@@ -484,7 +499,7 @@ static HRESULT compile_call_expression(compile_ctx_t *ctx, call_expression_t *ex
for(call = expr->call_expr; call->type == EXPR_BRACKETS; call = ((unary_expression_t*)call)->subexpr);
if(call->type == EXPR_MEMBER)
- return compile_member_expression(ctx, (member_expression_t*)call, arg_cnt, ret_val);
+ return compile_member_call_expression(ctx, (member_expression_t*)call, arg_cnt, ret_val);
hres = compile_expression(ctx, call);
if(FAILED(hres))
@@ -582,7 +597,7 @@ static HRESULT compile_expression(compile_ctx_t *ctx, expression_t *expr)
case EXPR_ME:
return push_instr(ctx, OP_me) ? S_OK : E_OUTOFMEMORY;
case EXPR_MEMBER:
- return compile_member_expression(ctx, (member_expression_t*)expr, 0, TRUE);
+ return compile_member_expression(ctx, (member_expression_t*)expr);
case EXPR_MOD:
return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_mod);
case EXPR_MUL:
diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c
index f648f073bc8..e2c1d5cc53d 100644
--- a/dlls/vbscript/interp.c
+++ b/dlls/vbscript/interp.c
@@ -615,10 +615,8 @@ static HRESULT variant_call(exec_ctx_t *ctx, VARIANT *v, unsigned arg_cnt, VARIA
return S_OK;
}
-static HRESULT do_icall(exec_ctx_t *ctx, VARIANT *res)
+static HRESULT do_icall(exec_ctx_t *ctx, VARIANT *res, BSTR identifier, unsigned arg_cnt)
{
- BSTR identifier = ctx->instr->arg1.bstr;
- const unsigned arg_cnt = ctx->instr->arg2.uint;
DISPPARAMS dp;
ref_t ref;
HRESULT hres;
@@ -687,12 +685,14 @@ static HRESULT do_icall(exec_ctx_t *ctx, VARIANT *res)
static HRESULT interp_icall(exec_ctx_t *ctx)
{
+ BSTR identifier = ctx->instr->arg1.bstr;
+ const unsigned arg_cnt = ctx->instr->arg2.uint;
VARIANT v;
HRESULT hres;
TRACE("\n");
- hres = do_icall(ctx, &v);
+ hres = do_icall(ctx, &v, identifier, arg_cnt);
if(FAILED(hres))
return hres;
@@ -701,8 +701,12 @@ static HRESULT interp_icall(exec_ctx_t *ctx)
static HRESULT interp_icallv(exec_ctx_t *ctx)
{
+ BSTR identifier = ctx->instr->arg1.bstr;
+ const unsigned arg_cnt = ctx->instr->arg2.uint;
+
TRACE("\n");
- return do_icall(ctx, NULL);
+
+ return do_icall(ctx, NULL, identifier, arg_cnt);
}
static HRESULT interp_vcall(exec_ctx_t *ctx)
@@ -788,6 +792,21 @@ static HRESULT interp_mcallv(exec_ctx_t *ctx)
return do_mcall(ctx, NULL);
}
+static HRESULT interp_ident(exec_ctx_t *ctx)
+{
+ BSTR identifier = ctx->instr->arg1.bstr;
+ VARIANT v;
+ HRESULT hres;
+
+ TRACE("%s\n", debugstr_w(identifier));
+
+ hres = do_icall(ctx, &v, identifier, 0);
+ if(FAILED(hres))
+ return hres;
+
+ return stack_push(ctx, &v);
+}
+
static HRESULT assign_value(exec_ctx_t *ctx, VARIANT *dst, VARIANT *src, WORD flags)
{
VARIANT value;
diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h
index 9ef2cae81e5..f5353b33cae 100644
--- a/dlls/vbscript/vbscript.h
+++ b/dlls/vbscript/vbscript.h
@@ -242,6 +242,7 @@ typedef enum {
X(gteq, 1, 0, 0) \
X(icall, 1, ARG_BSTR, ARG_UINT) \
X(icallv, 1, ARG_BSTR, ARG_UINT) \
+ X(ident, 1, ARG_BSTR, 0) \
X(idiv, 1, 0, 0) \
X(imp, 1, 0, 0) \
X(incc, 1, ARG_BSTR, 0) \
--
2.31.1
Oct. 1, 2021
Re: [PATCH v3] riched20: Fix saving to disk first-indent and left-indent (\fi and \li)
by Nikolay Sivov
Hi, Philip.
Please add a test for that in riched20/tests, from your change it looks
like you can load a stream and save it immediately to see the difference.
Oct. 1, 2021