mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-09-13 09:16:14 -07:00
libs/vkd3d: Use negative viewport height to flip along y-axis.
Requires VK_KHR_maintenance1.
This commit is contained in:
parent
d515e3d047
commit
4e5fcb5141
@ -35,6 +35,4 @@ void main()
|
||||
|
||||
colour_out.xyz = diffuse_in.xyz * att;
|
||||
colour_out.w = 1.0;
|
||||
|
||||
gl_Position.y = -gl_Position.y;
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ layout(location = 0) out vec4 colour_out;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_Position.xzw = position_in.xzw;
|
||||
gl_Position.y = -position_in.y;
|
||||
gl_Position = position_in;
|
||||
colour_out = colour_in;
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ const UINT D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES = 0xffffffff;
|
||||
const UINT D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT = 8;
|
||||
const UINT D3D12_TEXTURE_DATA_PITCH_ALIGNMENT = 256;
|
||||
const UINT D3D12_VS_INPUT_REGISTER_COUNT = 32;
|
||||
const UINT D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE = 16;
|
||||
|
||||
[uuid(8BA5FB08-5195-40E2-AC58-0D989C3A0102), object, local, pointer_default(unique)]
|
||||
interface ID3D10Blob : IUnknown
|
||||
|
@ -1807,14 +1807,27 @@ static void STDMETHODCALLTYPE d3d12_command_list_IASetPrimitiveTopology(ID3D12Gr
|
||||
static void STDMETHODCALLTYPE d3d12_command_list_RSSetViewports(ID3D12GraphicsCommandList *iface,
|
||||
UINT viewport_count, const D3D12_VIEWPORT *viewports)
|
||||
{
|
||||
VkViewport vk_viewports[D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];
|
||||
struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList(iface);
|
||||
const struct vkd3d_vk_device_procs *vk_procs;
|
||||
unsigned int i;
|
||||
|
||||
TRACE("iface %p, viewport_count %u, viewports %p.\n", iface, viewport_count, viewports);
|
||||
|
||||
assert(viewport_count <= D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE);
|
||||
|
||||
for (i = 0; i < viewport_count; ++i)
|
||||
{
|
||||
vk_viewports[i].x = viewports[i].TopLeftX;
|
||||
vk_viewports[i].y = viewports[i].TopLeftY + viewports[i].Height;
|
||||
vk_viewports[i].width = viewports[i].Width;
|
||||
vk_viewports[i].height = -viewports[i].Height;
|
||||
vk_viewports[i].minDepth = viewports[i].MinDepth;
|
||||
vk_viewports[i].maxDepth = viewports[i].MaxDepth;
|
||||
}
|
||||
|
||||
vk_procs = &list->device->vk_procs;
|
||||
VK_CALL(vkCmdSetViewport(list->vk_command_buffer, 0,
|
||||
viewport_count, (const struct VkViewport *)viewports));
|
||||
VK_CALL(vkCmdSetViewport(list->vk_command_buffer, 0, viewport_count, vk_viewports));
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d12_command_list_RSSetScissorRects(ID3D12GraphicsCommandList *iface,
|
||||
|
@ -815,22 +815,11 @@ static void blend_attachment_from_d3d12(struct VkPipelineColorBlendAttachmentSta
|
||||
FIXME("Ignoring LogicOpEnable %#x.\n", d3d12_desc->LogicOpEnable);
|
||||
}
|
||||
|
||||
static enum VkShaderStageFlagBits get_last_vertex_processing_stage(
|
||||
const D3D12_GRAPHICS_PIPELINE_STATE_DESC *desc)
|
||||
{
|
||||
if (desc->GS.pShaderBytecode)
|
||||
return VK_SHADER_STAGE_GEOMETRY_BIT;
|
||||
if (desc->DS.pShaderBytecode)
|
||||
return VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT;
|
||||
return VK_SHADER_STAGE_VERTEX_BIT;
|
||||
}
|
||||
|
||||
static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *state,
|
||||
struct d3d12_device *device, const D3D12_GRAPHICS_PIPELINE_STATE_DESC *desc)
|
||||
{
|
||||
struct d3d12_graphics_pipeline_state *graphics = &state->u.graphics;
|
||||
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
|
||||
enum VkShaderStageFlagBits last_vertex_stage;
|
||||
struct VkSubpassDescription sub_pass_desc;
|
||||
struct VkRenderPassCreateInfo pass_desc;
|
||||
const struct vkd3d_format *format;
|
||||
@ -858,20 +847,15 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
|
||||
state->ID3D12PipelineState_iface.lpVtbl = &d3d12_pipeline_state_vtbl;
|
||||
state->refcount = 1;
|
||||
|
||||
last_vertex_stage = get_last_vertex_processing_stage(desc);
|
||||
for (i = 0, graphics->stage_count = 0; i < ARRAY_SIZE(shader_stages); ++i)
|
||||
{
|
||||
const D3D12_SHADER_BYTECODE *b = (const void *)((uintptr_t)desc + shader_stages[i].offset);
|
||||
uint32_t compiler_options = 0;
|
||||
|
||||
if (!b->pShaderBytecode)
|
||||
continue;
|
||||
|
||||
if (shader_stages[i].stage == last_vertex_stage)
|
||||
compiler_options |= VKD3D_SHADER_FLIP_Y;
|
||||
|
||||
if (FAILED(hr = create_shader_stage(device, &graphics->stages[graphics->stage_count],
|
||||
shader_stages[i].stage, b, compiler_options)))
|
||||
shader_stages[i].stage, b, 0)))
|
||||
goto fail;
|
||||
|
||||
++graphics->stage_count;
|
||||
|
Loading…
Reference in New Issue
Block a user