Compare commits

...

3 Commits

Author SHA1 Message Date
Alexey Ushakov
b7079e643c Render State 2024-08-02 20:46:38 +02:00
Alexey Ushakov
2c284919e8 texture rendering 2024-08-02 00:45:49 +02:00
Alexey Ushakov
1feb6960f8 Implement draw texture
Moved shared VkRenderPass to the logical device
2024-08-01 16:13:48 +02:00
10 changed files with 387 additions and 20 deletions

View File

@@ -741,6 +741,7 @@ static jboolean VK_InitLogicalDevice(VKLogicalDevice* logicalDevice) {
DEVICE_PROC(vkDestroyFramebuffer);
DEVICE_PROC(vkFlushMappedMemoryRanges);
DEVICE_PROC(vkCmdPushConstants);
DEVICE_PROC(vkCmdCopyBufferToImage);
// Create command pool
VkCommandPoolCreateInfo poolInfo = {

View File

@@ -27,6 +27,7 @@
#ifndef VKBase_h_Included
#define VKBase_h_Included
#include "VKTypes.h"
#include "VKRenderState.h"
struct VKLogicalDevice {
VkDevice device;
@@ -47,6 +48,7 @@ struct VKLogicalDevice {
VkQueue queue;
VkSampler textureSampler;
VKBuffer* blitVertexBuffer;
VKRenderState renderState;
VkRenderPass renderPass;
PFN_vkDestroyDevice vkDestroyDevice;
@@ -101,6 +103,7 @@ struct VKLogicalDevice {
PFN_vkDestroyFramebuffer vkDestroyFramebuffer;
PFN_vkFlushMappedMemoryRanges vkFlushMappedMemoryRanges;
PFN_vkCmdPushConstants vkCmdPushConstants;
PFN_vkCmdCopyBufferToImage vkCmdCopyBufferToImage;
};

View File

@@ -0,0 +1,213 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, JetBrains s.r.o.. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include <malloc.h>
#include <string.h>
#include "jlong.h"
#include "SurfaceData.h"
#include "VKBlitLoops.h"
#include "VKSurfaceData.h"
#include "VKRenderQueue.h"
#include "Trace.h"
#include "VKImage.h"
#include "VKRenderer.h"
#include "VKImage.h"
#include "VKVertex.h"
#include "CArrayUtil.h"
static void VKBlitSwToTextureViaPooledTexture(VKLogicalDevice* logicalDevice, VKImage* dest, const SurfaceDataRasInfo *srcInfo,
int dx1, int dy1, int dx2, int dy2) {
const int sw = srcInfo->bounds.x2 - srcInfo->bounds.x1;
const int sh = srcInfo->bounds.y2 - srcInfo->bounds.y1;
const int dw = dx2 - dx1;
const int dh = dy2 - dy1;
if (dw < sw || dh < sh) {
J2dTraceLn4(J2D_TRACE_ERROR, "replaceTextureRegion: dest size: (%d, %d) less than source size: (%d, %d)", dw, dh, sw, sh);
return;
}
float width = dest->extent.width/2.0;
float height = dest->extent.height/2.0;
J2dRlsTraceLn2(J2D_TRACE_VERBOSE,
"VKRenderQueue_flushBuffer: FILL_PARALLELOGRAM(W=%f, H=%f)",
width, height);
VKTxVertex* vertices = ARRAY_ALLOC(VKTxVertex, 4);
/*
* (p1)---------(p2)
* | |
* | |
* | |
* (p4)---------(p3)
*/
float p1x = -1.0f + dx1 / width;
float p1y = -1.0f + dy1 / height;
float p2x = -1.0f + dx2 / width;
float p2y = -1.0f + dy1 / height;
float p3x = -1.0f + dx2 / width;
float p3y = -1.0f + dy2 / height;
float p4x = -1.0f + dx1 / width;
float p4y = -1.0f + dy2 / height;
ARRAY_PUSH_BACK(&vertices, ((VKTxVertex) {p1x, p1y, 0.0f, 0.0f}));
ARRAY_PUSH_BACK(&vertices, ((VKTxVertex) {p2x, p2y, 1.0f, 0.0f}));
ARRAY_PUSH_BACK(&vertices, ((VKTxVertex) {p4x, p4y, 0.0f, 1.0f}));
ARRAY_PUSH_BACK(&vertices, ((VKTxVertex) {p3x, p3y, 1.0f, 1.0f}));
VKBuffer* renderVertexBuffer = ARRAY_TO_VERTEX_BUF(logicalDevice, vertices);
ARRAY_FREE(vertices);
VKRenderer_BeginRendering(logicalDevice);
const char *raster = srcInfo->rasBase;
raster += (uint32_t)srcInfo->bounds.y1 * (uint32_t)srcInfo->scanStride + (uint32_t)srcInfo->bounds.x1 * (uint32_t)srcInfo->pixelStride;
VKImage *image = VKImage_Create(logicalDevice, sw, sh, VK_FORMAT_R8G8B8A8_UNORM, VK_IMAGE_TILING_LINEAR,
VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT,
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
J2dTraceLn4(J2D_TRACE_VERBOSE, "replaceTextureRegion src (dw, dh) : [%d, %d] dest (dx1, dy1) =[%d, %d]",
dw, dh, dx1, dy1);
uint32_t dataSize = sw * sh * srcInfo->pixelStride;
char* data = malloc(dataSize);
// copy src pixels inside src bounds to buff
for (int row = 0; row < sh; row++) {
memcpy(data + (row * sw * srcInfo->pixelStride), raster, sw * srcInfo->pixelStride);
raster += (uint32_t)srcInfo->scanStride;
}
VKBuffer *buffer = VKBuffer_CreateFromData(logicalDevice, data, dataSize);
//free(data);
VKImage_LoadBuffer(logicalDevice, image, buffer, dx1, dy1, sw, sh);
VKRenderer_TextureRender(logicalDevice, dest, image, renderVertexBuffer->buffer, 4);
VKRenderer_EndRendering(logicalDevice, VK_FALSE, VK_FALSE);
}
void VKBlitLoops_IsoBlit(JNIEnv *env,
VKLogicalDevice* logicalDevice, jlong pSrcOps, jlong pDstOps,
jboolean xform, jint hint,
jboolean texture,
jint sx1, jint sy1,
jint sx2, jint sy2,
jdouble dx1, jdouble dy1,
jdouble dx2, jdouble dy2)
{
J2dRlsTraceLn8(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: BLIT_IsoBlit (%d %d %d %d) -> (%f %f %f %f) ",
sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2);
J2dRlsTraceLn2(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: BLIT_IsoBlit texture=%d xform=%d",
texture, xform)
}
void VKBlitLoops_Blit(JNIEnv *env,
VKLogicalDevice* logicalDevice, jlong pSrcOps, jlong pDstOps,
jboolean xform, jint hint,
jint srctype, jboolean texture,
jint sx1, jint sy1,
jint sx2, jint sy2,
jdouble dx1, jdouble dy1,
jdouble dx2, jdouble dy2)
{
J2dRlsTraceLn8(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: BLIT_Blit (%d %d %d %d) -> (%f %f %f %f) ",
sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2)
J2dRlsTraceLn3(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: BLIT_Blit texture=%d xform=%d srctype=%d",
texture, xform, srctype)
SurfaceDataOps *srcOps = (SurfaceDataOps *)jlong_to_ptr(pSrcOps);
VKSDOps *dstOps = (VKSDOps *)jlong_to_ptr(pDstOps);
RETURN_IF_NULL(logicalDevice);
RETURN_IF_NULL(srcOps);
RETURN_IF_NULL(dstOps);
VKImage *dest = dstOps->image;
if (dest == NULL) {
J2dTraceLn(J2D_TRACE_ERROR, "MTLBlitLoops_Blit: dest is null");
return;
}
// if (srctype < 0 || srctype >= sizeof(RasterFormatInfos)/ sizeof(MTLRasterFormatInfo)) {
// J2dTraceLn1(J2D_TRACE_ERROR, "MTLBlitLoops_Blit: source pixel format %d isn't supported", srctype);
// return;
// }
const jint sw = sx2 - sx1;
const jint sh = sy2 - sy1;
const jint dw = dx2 - dx1;
const jint dh = dy2 - dy1;
if (sw <= 0 || sh <= 0 || dw <= 0 || dh <= 0) {
J2dTraceLn(J2D_TRACE_ERROR, "MTLBlitLoops_Blit: invalid dimensions");
return;
}
// if (!xform) {
// clipDestCoords(
// &dx1, &dy1, &dx2, &dy2,
// &sx1, &sy1, &sx2, &sy2,
// dest.width, dest.height, texture ? NULL : [mtlc.clip getRect]
// );
// }
SurfaceDataRasInfo srcInfo;
srcInfo.bounds.x1 = sx1;
srcInfo.bounds.y1 = sy1;
srcInfo.bounds.x2 = sx2;
srcInfo.bounds.y2 = sy2;
// NOTE: This function will modify the contents of the bounds field to represent the maximum available raster data.
if (srcOps->Lock(env, srcOps, &srcInfo, SD_LOCK_READ) != SD_SUCCESS) {
J2dTraceLn(J2D_TRACE_WARNING, "MTLBlitLoops_Blit: could not acquire lock");
return;
}
if (srcInfo.bounds.x2 > srcInfo.bounds.x1 && srcInfo.bounds.y2 > srcInfo.bounds.y1) {
srcOps->GetRasInfo(env, srcOps, &srcInfo);
if (srcInfo.rasBase) {
if (srcInfo.bounds.x1 != sx1) {
const int dx = srcInfo.bounds.x1 - sx1;
dx1 += dx * (dw / sw);
}
if (srcInfo.bounds.y1 != sy1) {
const int dy = srcInfo.bounds.y1 - sy1;
dy1 += dy * (dh / sh);
}
if (srcInfo.bounds.x2 != sx2) {
const int dx = srcInfo.bounds.x2 - sx2;
dx2 += dx * (dw / sw);
}
if (srcInfo.bounds.y2 != sy2) {
const int dy = srcInfo.bounds.y2 - sy2;
dy2 += dy * (dh / sh);
}
// MTLRasterFormatInfo rfi = RasterFormatInfos[srctype];
//
// if (texture) {
// replaceTextureRegion(mtlc, dest, &srcInfo, &rfi, (int) dx1, (int) dy1, (int) dx2, (int) dy2);
// } else {
VKBlitSwToTextureViaPooledTexture(logicalDevice, dest, &srcInfo, dx1, dy1, dx2, dy2);
// }
}
SurfaceData_InvokeRelease(env, srcOps, &srcInfo);
}
SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
}

View File

@@ -0,0 +1,60 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, JetBrains s.r.o.. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#ifndef VKBlitLoops_h_Included
#define VKBlitLoops_h_Included
#include "jni.h"
#include "sun_java2d_vulkan_VKBlitLoops.h"
#include "VKBase.h"
#define OFFSET_SRCTYPE sun_java2d_vulkan_VKBlitLoops_OFFSET_SRCTYPE
#define OFFSET_HINT sun_java2d_vulkan_VKBlitLoops_OFFSET_HINT
#define OFFSET_TEXTURE sun_java2d_vulkan_VKBlitLoops_OFFSET_TEXTURE
#define OFFSET_RTT sun_java2d_vulkan_VKBlitLoops_OFFSET_RTT
#define OFFSET_XFORM sun_java2d_vulkan_VKBlitLoops_OFFSET_XFORM
#define OFFSET_ISOBLIT sun_java2d_vulkan_VKBlitLoops_OFFSET_ISOBLIT
void VKBlitLoops_IsoBlit(JNIEnv *env,
VKLogicalDevice* logicalDevice, jlong pSrcOps, jlong pDstOps,
jboolean xform, jint hint,
jboolean texture,
jint sx1, jint sy1,
jint sx2, jint sy2,
jdouble dx1, jdouble dy1,
jdouble dx2, jdouble dy2);
void VKBlitLoops_Blit(JNIEnv *env,
VKLogicalDevice* logicalDevice, jlong pSrcOps, jlong pDstOps,
jboolean xform, jint hint,
jint srctype, jboolean texture,
jint sx1, jint sy1,
jint sx2, jint sy2,
jdouble dx1, jdouble dy1,
jdouble dx2, jdouble dy2);
#endif /* VKBlitLoops_h_Included */

View File

@@ -197,6 +197,31 @@ VKImage* VKImage_CreateImageArrayFromSwapChain(VKLogicalDevice* logicalDevice,
return images;
}
void VKImage_LoadBuffer(VKLogicalDevice* logicalDevice, VKImage* image, VKBuffer* buffer,
uint32_t x0, uint32_t y0, uint32_t width, uint32_t height) {
VkBufferImageCopy region = (VkBufferImageCopy){
.bufferOffset = 0,
.bufferRowLength = 0,
.bufferImageHeight = 0,
.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.imageSubresource.mipLevel = 0,
.imageSubresource.baseArrayLayer = 0,
.imageSubresource.layerCount = 1,
.imageOffset = {x0, y0, 0},
.imageExtent = {
.width = width,
.height = height,
.depth = 1
}
};
logicalDevice->vkCmdCopyBufferToImage(logicalDevice->commandBuffer,
buffer->buffer, image->image,
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
1, &region);
}
void VKImage_dealloc(VKLogicalDevice* logicalDevice, VKImage* image) {
if (!image) return;

View File

@@ -54,6 +54,9 @@ VKImage* VKImage_CreateImageArrayFromSwapChain(VKLogicalDevice* logicalDevice,
VkBool32 VKImage_CreateFramebuffer(VKLogicalDevice* logicalDevice,
VKImage *image, VkRenderPass renderPass);
void VKImage_LoadBuffer(VKLogicalDevice* logicalDevice, VKImage* image, VKBuffer* buffer,
uint32_t x0, uint32_t y0, uint32_t width, uint32_t height);
void VKImage_free(VKLogicalDevice* logicalDevice, VKImage* image);
void VKImage_dealloc(VKLogicalDevice* logicalDevice, VKImage* image);
#endif // VKImage_h_Included

View File

@@ -29,13 +29,14 @@
#include "sun_java2d_pipe_BufferedOpCodes.h"
#include "sun_java2d_pipe_BufferedRenderPipe.h"
#include "sun_java2d_pipe_BufferedTextPipe.h"
#include "sun_java2d_vulkan_VKBlitLoops.h"
#include "Trace.h"
#include "jlong.h"
#include "VKRenderQueue.h"
#include "VKSurfaceData.h"
#include "VKRenderer.h"
#include "VKVertex.h"
#include "VKBlitLoops.h"
#include "VKRenderState.h"
#define BYTES_PER_POLY_POINT \
sun_java2d_pipe_BufferedRenderPipe_BYTES_PER_POLY_POINT
@@ -56,20 +57,10 @@
#define OFFSET_SUBPIXPOS sun_java2d_pipe_BufferedTextPipe_OFFSET_SUBPIXPOS
#define OFFSET_POSITIONS sun_java2d_pipe_BufferedTextPipe_OFFSET_POSITIONS
#define OFFSET_SRCTYPE sun_java2d_vulkan_VKBlitLoops_OFFSET_SRCTYPE
#define OFFSET_HINT sun_java2d_vulkan_VKBlitLoops_OFFSET_HINT
#define OFFSET_TEXTURE sun_java2d_vulkan_VKBlitLoops_OFFSET_TEXTURE
#define OFFSET_RTT sun_java2d_vulkan_VKBlitLoops_OFFSET_RTT
#define OFFSET_XFORM sun_java2d_vulkan_VKBlitLoops_OFFSET_XFORM
#define OFFSET_ISOBLIT sun_java2d_vulkan_VKBlitLoops_OFFSET_ISOBLIT
static VKSDOps *dstOps = NULL;
static VKLogicalDevice* currentDevice;
// TODO move this property to special drawing context structure
static int color = -1;
JNIEXPORT void JNICALL Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
(JNIEnv *env, jobject oglrq, jlong buf, jint limit)
{
@@ -161,7 +152,7 @@ JNIEXPORT void JNICALL Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
"VKRenderQueue_flushBuffer: DRAW_PARALLELOGRAM(%f, %f, %f, %f, %f, %f, %f, %f)",
x11, y11, dx21, dy21, dx12, dy12, lwr21, lwr12);
VKRenderer_RenderParallelogram(currentDevice, currentDevice->drawColorPoly,
color, dstOps, x11, y11, dx21, dy21, dx12, dy12);
0, dstOps, x11, y11, dx21, dy21, dx12, dy12);
}
break;
case sun_java2d_pipe_BufferedOpCodes_DRAW_AAPARALLELOGRAM:
@@ -197,7 +188,7 @@ JNIEXPORT void JNICALL Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
jint count = NEXT_INT(b);
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
"VKRenderQueue_flushBuffer: FILL_SPANS");
VKRenderer_FillSpans(currentDevice, color, dstOps, count, (jint *)b);
VKRenderer_FillSpans(currentDevice, 0, dstOps, count, (jint *)b);
SKIP_BYTES(b, count * BYTES_PER_SPAN);
}
break;
@@ -213,7 +204,7 @@ JNIEXPORT void JNICALL Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
"VKRenderQueue_flushBuffer: FILL_PARALLELOGRAM(%f, %f, %f, %f, %f, %f)",
x11, y11, dx21, dy21, dx12, dy12);
VKRenderer_RenderParallelogram(currentDevice, currentDevice->fillColorPoly,
color, dstOps, x11, y11, dx21, dy21, dx12, dy12);
0, dstOps, x11, y11, dx21, dy21, dx12, dy12);
}
break;
case sun_java2d_pipe_BufferedOpCodes_FILL_AAPARALLELOGRAM:
@@ -296,7 +287,25 @@ JNIEXPORT void JNICALL Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
OFFSET_XFORM);
jboolean isoblit = EXTRACT_BOOLEAN(packedParams,
OFFSET_ISOBLIT);
J2dRlsTraceLn(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: BLIT");
if (isoblit) {
VKBlitLoops_IsoBlit(env, currentDevice, pSrc, pDst,
xform, hint, texture,
sx1, sy1, sx2, sy2,
dx1, dy1, dx2, dy2);
} else {
jint srctype = EXTRACT_BYTE(packedParams, OFFSET_SRCTYPE);
VKBlitLoops_Blit(env, currentDevice, pSrc, pDst,
xform, hint, srctype, texture,
sx1, sy1, sx2, sy2,
dx1, dy1, dx2, dy2);
}
break;
J2dRlsTraceLn8(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: BLIT (%d %d %d %d) -> (%f %f %f %f) ",
sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2)
J2dRlsTraceLn4(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: BLIT texture=%d rtt=%d xform=%d isoblit=%d",
texture, rtt, xform, isoblit)
}
break;
case sun_java2d_pipe_BufferedOpCodes_SURFACE_TO_SW_BLIT:
@@ -407,8 +416,18 @@ JNIEXPORT void JNICALL Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
jdouble m11 = NEXT_DOUBLE(b);
jdouble m02 = NEXT_DOUBLE(b);
jdouble m12 = NEXT_DOUBLE(b);
J2dRlsTraceLn3(J2D_TRACE_VERBOSE,
"VKRenderQueue_flushBuffer: SET_TRANSFORM | %.2f %.2f %.2f |", m00, m01, m02);
J2dRlsTraceLn3(J2D_TRACE_VERBOSE,
" | %.2f %.2f %.2f |", m10, m11, m12);
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
"VKRenderQueue_flushBuffer: SET_TRANSFORM");
" | 0.00 0.00 1.00 |");
currentDevice->renderState.m00 = m00;
currentDevice->renderState.m01 = m01;
currentDevice->renderState.m10 = m10;
currentDevice->renderState.m11 = m11;
currentDevice->renderState.m02 = m02;
currentDevice->renderState.m12 = m12;
}
break;
case sun_java2d_pipe_BufferedOpCodes_RESET_TRANSFORM:
@@ -517,7 +536,7 @@ JNIEXPORT void JNICALL Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
case sun_java2d_pipe_BufferedOpCodes_SET_COLOR:
{
jint pixel = NEXT_INT(b);
color = pixel;
currentDevice->renderState.color = pixel;
J2dRlsTraceLn1(J2D_TRACE_VERBOSE,
"VKRenderQueue_flushBuffer: SET_COLOR %d", pixel);
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, JetBrains s.r.o.. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#ifndef VKRenderState_h_Included
#define VKRenderState_h_Included
#include <stdint.h>
struct VKRenderState {
uint32_t color;
double m00;
double m10;
double m01;
double m11;
double m02;
double m12;
};
#endif /* VKRenderState_h_Included */

View File

@@ -856,7 +856,7 @@ void VKRenderer_RenderParallelogram(VKLogicalDevice* logicalDevice,
VKRenderer_ColorRender(
logicalDevice,
vksdOps->image, renderer,
color,
logicalDevice->renderState.color,
renderVertexBuffer->buffer, vertexNum);
}
@@ -917,7 +917,7 @@ void VKRenderer_FillSpans(VKLogicalDevice* logicalDevice, jint color, VKSDOps *d
VKRenderer_ColorRender(
logicalDevice,
vksdOps->image, logicalDevice->fillColorPoly,
color,
logicalDevice->renderState.color,
fillVertexBuffer->buffer, VERT_COUNT);
}

View File

@@ -34,5 +34,5 @@ STRUCT(VKLogicalDevice);
STRUCT(VKRenderer);
STRUCT(VKBuffer);
STRUCT(VKImage);
STRUCT(VKRenderState);
#endif //VKTypes_h_Included