Commit 14ec3300 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

d3d10/effect: Implement GetString().

parent b73ed197
......@@ -5794,6 +5794,11 @@ static const struct ID3D10EffectMatrixVariableVtbl d3d10_effect_matrix_variable_
/* ID3D10EffectVariable methods */
static inline struct d3d10_effect_variable *impl_from_ID3D10EffectStringVariable(ID3D10EffectStringVariable *iface)
{
return CONTAINING_RECORD(iface, struct d3d10_effect_variable, ID3D10EffectVariable_iface);
}
static BOOL STDMETHODCALLTYPE d3d10_effect_string_variable_IsValid(ID3D10EffectStringVariable *iface)
{
TRACE("iface %p\n", iface);
......@@ -5950,9 +5955,20 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetRawValue(ID3D10
static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetString(ID3D10EffectStringVariable *iface,
const char **str)
{
FIXME("iface %p, str %p stub!\n", iface, str);
struct d3d10_effect_variable *var = impl_from_ID3D10EffectStringVariable(iface);
char *value = (char *)var->u.buffer.local_buffer;
return E_NOTIMPL;
TRACE("iface %p, str %p.\n", iface, str);
if (!value)
return E_FAIL;
if (!str)
return E_INVALIDARG;
*str = value;
return S_OK;
}
static HRESULT STDMETHODCALLTYPE d3d10_effect_string_variable_GetStringArray(ID3D10EffectStringVariable *iface,
......
......@@ -1422,22 +1422,28 @@ static void test_effect_variable_type_class(void)
ok(td.Stride == 0x0, "Stride is %#x, expected 0x0\n", td.Stride);
string_var = variable->lpVtbl->AsString(variable);
hr = string_var->lpVtbl->GetString(string_var, NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
hr = string_var->lpVtbl->GetString(string_var, &str1);
todo_wine
ok(SUCCEEDED(hr), "GetString failed, hr %#x.\n", hr);
if (SUCCEEDED(hr))
ok(!strcmp(str1, "STRING"), "Unexpected value %s.\n", str1);
ok(!strcmp(str1, "STRING"), "Unexpected value %s.\n", str1);
variable = constantbuffer->lpVtbl->GetAnnotationByIndex(constantbuffer, 1);
string_var = variable->lpVtbl->AsString(variable);
hr = string_var->lpVtbl->GetString(string_var, &str2);
todo_wine
ok(SUCCEEDED(hr), "GetString failed, hr %#x.\n", hr);
if (SUCCEEDED(hr))
{
ok(str2 != str1, "Unexpected string pointer.\n");
ok(!strcmp(str2, "STRING"), "Unexpected value %s.\n", str1);
}
ok(str2 != str1, "Unexpected string pointer.\n");
ok(!strcmp(str2, "STRING"), "Unexpected value %s.\n", str1);
/* Only two annotations */
variable = constantbuffer->lpVtbl->GetAnnotationByIndex(constantbuffer, 2);
string_var = variable->lpVtbl->AsString(variable);
hr = string_var->lpVtbl->GetString(string_var, NULL);
ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr);
str1 = (void *)0xdeadbeef;
hr = string_var->lpVtbl->GetString(string_var, &str1);
ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr);
ok(str1 == (void *)0xdeadbeef, "Unexpected pointer.\n");
/* check float f */
variable = constantbuffer->lpVtbl->GetMemberByIndex(constantbuffer, variable_nr++);
......
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